This man is too old to remember everything in his brain. Right now, he needs a place to write down what he has studied.
標籤
4GL
(1)
人才發展
(10)
人物
(3)
太陽能
(4)
心理
(3)
心靈
(10)
文學
(31)
生活常識
(14)
光學
(1)
名句
(10)
即時通訊軟體
(2)
奇狐
(2)
爬蟲
(1)
音樂
(2)
產業
(5)
郭語錄
(3)
無聊
(3)
統計
(4)
新聞
(1)
經濟學
(1)
經營管理
(42)
解析度
(1)
遊戲
(5)
電學
(1)
網管
(10)
廣告
(1)
數學
(1)
機率
(1)
雜趣
(1)
證券
(4)
證券期貨
(1)
ABAP
(15)
AD
(1)
agentflow
(4)
AJAX
(1)
Android
(1)
AnyChart
(1)
Apache
(14)
BASIS
(4)
BDL
(1)
C#
(1)
Church
(1)
CIE
(1)
CO
(38)
Converter
(1)
cron
(1)
CSS
(23)
DMS
(1)
DVD
(1)
Eclipse
(1)
English
(1)
excel
(5)
Exchange
(4)
Failover
(1)
Fedora
(1)
FI
(57)
File Transfer
(1)
Firefox
(3)
FM
(2)
fourjs
(1)
Genero
(1)
gladiatus
(1)
google
(1)
Google Maps API
(2)
grep
(1)
Grub
(1)
HR
(2)
html
(23)
HTS
(8)
IE
(1)
IE 8
(1)
IIS
(1)
IMAP
(3)
Internet Explorer
(1)
java
(4)
JavaScript
(22)
jQuery
(6)
JSON
(1)
K3b
(1)
ldd
(1)
LED
(3)
Linux
(117)
Linux Mint
(4)
Load Balance
(1)
Microsoft
(2)
MIS
(2)
MM
(51)
MSSQL
(1)
MySQL
(27)
Network
(1)
NFS
(1)
Office
(1)
OpenSSL
(1)
Oracle
(126)
Outlook
(3)
PDF
(6)
Perl
(60)
PHP
(33)
PL/SQL
(1)
PL/SQL Developer
(1)
PM
(3)
Postfix
(2)
postfwd
(1)
PostgreSQL
(1)
PP
(50)
python
(5)
QM
(1)
Red Hat
(4)
Reporting Service
(28)
ruby
(11)
SAP
(234)
scp
(1)
SD
(16)
sed
(1)
Selenium
(3)
Selenium-WebDriver
(5)
shell
(5)
SQL
(4)
SQL server
(8)
sqlplus
(1)
SQuirreL SQL Client
(1)
SSH
(2)
SWOT
(3)
Symantec
(2)
T-SQL
(7)
Tera Term
(2)
tip
(1)
tiptop
(24)
Tomcat
(6)
Trouble Shooting
(1)
Tuning
(5)
Ubuntu
(37)
ufw
(1)
utf-8
(1)
VIM
(11)
Virtual Machine
(2)
VirtualBox
(1)
vnc
(3)
Web Service
(2)
wget
(1)
Windows
(19)
Windows
(1)
WM
(6)
Xvfb
(2)
youtube
(1)
yum
(2)
2012年11月19日 星期一
SAPLZM008
PROCESS BEFORE OUTPUT.
MODULE STATUS_3000.
LOOP WITH CONTROL TC_ZST046.
MODULE FILL_TABLE_CONTROL.
ENDLOOP.
*
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ZST046.
MODULE READ_TABLE_CONTROL.
ENDLOOP.
* MODULE UPDATE_ZST046.
PROCESS ON VALUE-REQUEST.
* FIELD ZST046-MATNRO MODULE VALUE_MATNRO_INPUT.
FIELD ZST046-MATNRO MODULE VALUE_ZST046_MATNRO_INPUT.
FIELD ZST046-MATNRC MODULE VALUE_ZST046_MATNRC_INPUT.
FIELD ZST046-ZGROUP MODULE VALUE_ZST046_ZGROUP_INPUT.
FIELD ZST046-LEDC MODULE VALUE_ZST046_LEDC_INPUT.
FIELD ZST046-SEQNO MODULE VALUE_ZST046_SEQNO_INPUT.
*----------------------------------------------------------------------*
***INCLUDE LZM008O01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module modify_screen_attrib OUTPUT
*&---------------------------------------------------------------------*
module modify_screen_attrib output.
loop at screen.
case trantype.
when 'A'.
screen-input = 0.
endcase.
modify screen.
endloop.
endmodule. " modify_screen_attrib OUTPUT
*{ INSERT DEVK900156 1
*&---------------------------------------------------------------------*
*& Module STATUS_3000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_3000 OUTPUT.
**先看ZST046有沒有對應DN的資料
**CLEAR it_zst046.
**FREE it_zst046.
* SELECT SINGLE * FROM ZST046
* WHERE VBELN = LIPS-VGBEL
* AND POSNR = LIPS-VGPOS.
* IF SY-SUBRC = 0.
* SELECT *
* FROM ZST046
* WHERE VBELN = LIPS-VGBEL
* AND POSNR = LIPS-VGPOS.
* READ TABLE IT_ZST046 WITH KEY VBELN = ZST046-VBELN
* POSNR = ZST046-POSNR
* SEQNO = ZST046-SEQNO.
* IF SY-SUBRC <> 0.
* READ TABLE D_ZST046 WITH KEY VBELN = ZST046-VBELN
* POSNR = ZST046-POSNR
* SEQNO = ZST046-SEQNO.
**如果在紀錄DELETE的INTERNAL TABLE也找不到,代表確實要新增
* IF SY-SUBRC <> 0.
* MOVE-CORRESPONDING ZST046 TO IT_ZST046.
* APPEND IT_ZST046.
* ENDIF.
* ENDIF.
* ENDSELECT.
* ENDIF.
* DESCRIBE TABLE IT_ZST046 LINES L_LINES.
**如果沒有,則去SALES ORDER的ZST045抓對應的SO資料
**20100910 BY SM
** IF L_LINES = 0.
*CLEAR IT_ZST046.
*FREE IT_ZST046.
* SELECT *
* INTO CORRESPONDING FIELDS OF TABLE IT_ZST046
* FROM ZST045
* WHERE VBELN = LIPS-VGBEL
* AND POSNR = LIPS-VGPOS
* AND KUNNR = LIKP-KUNAG.
** ENDIF.
* LOOP AT IT_ZST046.
* IT_ZST046-VBELN = LIPS-VBELN.
* IT_ZST046-POSNR = LIPS-POSNR.
* MODIFY IT_ZST046.
* ENDLOOP.
* L_LINES = 0.
* LOOP AT IT_ZST046 WHERE VBELN = LIPS-VBELN AND POSNR = LIPS-POSNR.
* L_LINES = L_LINES + 1.
* ENDLOOP.
DESCRIBE TABLE IT_ZST046 LINES L_LINES.
TC_ZST046-LINES = L_LINES.
SORT IT_ZST046 BY POSNR SEQNO.
ENDMODULE. " STATUS_3000 OUTPUT
*} INSERT
*{ INSERT DEVK900156 2
*&---------------------------------------------------------------------*
*& Module FILL_TABLE_CONTROL OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE FILL_TABLE_CONTROL OUTPUT.
* READ TABLE IT_ZST046 INTO ZST046 INDEX TC_ZST046-CURRENT_LINE.
L_LINES = 0.
LOOP AT IT_ZST046 WHERE VBELN = LIPS-VBELN AND POSNR = LIPS-POSNR
AND MATNR = LIPS-MATNR. "20110905 BY SM
L_LINES = L_LINES + 1.
IF L_LINES = TC_ZST046-CURRENT_LINE.
MOVE-CORRESPONDING IT_ZST046 TO ZST046 .
ENDIF.
ENDLOOP.
ENDMODULE. " FILL_TABLE_CONTROL OUTPUT
*} INSERT
*----------------------------------------------------------------------*
***INCLUDE LZM008I01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module beleg_suchen INPUT
*&---------------------------------------------------------------------*
MODULE BELEG_SUCHEN INPUT.
DATA: FLAG.
FLAG = 'X'.
EXPORT FLAG TO MEMORY ID 'MB51_FLAG'.
CALL TRANSACTION 'MB51'.
GET PARAMETER ID 'MBN' FIELD LIPS-REFDOCNR.
GET PARAMETER ID 'POS' FIELD LIPS-REFDOCITEM.
ENDMODULE. " beleg_suchen INPUT
*&---------------------------------------------------------------------*
*& Module READ_TABLE_CONTROL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE READ_TABLE_CONTROL INPUT.
DESCRIBE TABLE IT_ZST046 LINES L_LINES.
IF ZST046-MATNRO IS INITIAL.
* DELETE IT_ZST046 INDEX TC_ZST046-CURRENT_LINE.
DELETE IT_ZST046 WHERE VBELN = ZST046-VBELN AND
POSNR = ZST046-POSNR AND
SEQNO = ZST046-SEQNO.
ELSE.
ZST046-VBELN = LIPS-VBELN.
ZST046-POSNR = LIPS-POSNR.
ZST046-MATNR = LIPS-MATNR.
ZST046-KUNNR = LIKP-KUNAG.
READ TABLE IT_ZST046 WITH KEY VBELN = ZST046-VBELN
POSNR = ZST046-POSNR
SEQNO = ZST046-SEQNO
*20101025 BY SM 若有修改料號,也要能判斷
MATNR = ZST046-MATNR
KUNNR = ZST046-KUNNR.
IF SY-SUBRC = 0.
MODIFY IT_ZST046 FROM ZST046 TRANSPORTING
VBELN POSNR MATNR MATNRO MATNRC KUNNR CHPCAT
IVULMT IVMIN IVMAX VFULMT VFMIN VFMAX
WDULMT WDMIN WDMAX CTULMT CCTMIN CCTMAX
CIE1 CIE2 CIE3 CIE4 CIE5 CIE6 CIE7 CIE8
CIE9 CIE10 CIE11 CIE12 CIE13 CIE14 CIE15 CIE16
WHERE VBELN = ZST046-VBELN
AND POSNR = ZST046-POSNR
*20110905 BY SM
AND KUNNR = ZST046-KUNNR
AND MATNR = ZST046-MATNR
* AND MATNRO = ZST046-MATNRO "20111017 BY SM
* AND MATNRC = ZST046-MATNRC
* AND ZGROUP = ZST046-ZGROUP
* AND LEDC = ZST046-LEDC
AND SEQNO = ZST046-SEQNO.
ELSE.
IF ZST046-SEQNO <> SPACE.
DELETE IT_ZST046 WHERE VBELN = ZST046-VBELN AND POSNR = ZST046-POSNR AND SEQNO = ZST046-SEQNO.
MOVE-CORRESPONDING ZST046 TO IT_ZST046.
APPEND IT_ZST046.
ENDIF.
ENDIF.
ENDIF.
* ELSEIF TC_ZST046-CURRENT_LINE <= L_LINES.
* MODIFY IT_ZST046 FROM ZST046 INDEX TC_ZST046-CURRENT_LINE.
* ELSE.
* ZST046-VBELN = LIPS-VBELN.
* ZST046-POSNR = LIPS-POSNR.
* ZST046-MATNR = LIPS-MATNR.
* ZST046-KUNNR = LIKP-KUNAG.
* MOVE-CORRESPONDING ZST046 TO IT_ZST046.
* APPEND IT_ZST046.
* ENDIF.
ENDMODULE. " READ_TABLE_CONTROL INPUT
*&---------------------------------------------------------------------*
*& Module UPDATE_ZST046 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE UPDATE_ZST046 INPUT.
FREE MEMORY ID 'ZST046'.
EXPORT IT_ZST046 TO MEMORY ID 'ZST046'.
* DELETE FROM ZST046
* WHERE VBELN = LIPS-VBELN
* AND POSNR = LIPS-POSNR.
*20100910 BY SM ->MARK LINE 77
* MODIFY ZST046 FROM TABLE IT_ZST046.
*
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = 'X'.
ENDMODULE. " UPDATE_ZST046 INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_MATNRO_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_SEQNO_INPUT INPUT.
DATA: IT_TMP TYPE ZST046 OCCURS 0 WITH HEADER LINE,
IT_RET TYPE DDSHRETVAL OCCURS 0 WITH HEADER LINE,
IT_DYNPFIELDS TYPE DYNPREAD OCCURS 0 WITH HEADER LINE,
L_COVT(10) TYPE C,
L_CVTN TYPE N.
DATA: L_SEQNO LIKE ZST046-SEQNO.
DATA : L_CURSORFIELD(20) VALUE 'ZST046-SEQNO'.
*20110905 BY SM
CLEAR L_LINE.
GET CURSOR LINE L_LINE.
SET CURSOR FIELD 'ZST046-SEQNO'.
GET CURSOR FIELD L_CURSORFIELD VALUE L_SEQNO.
CLEAR IT_DYNPFIELDS. REFRESH IT_DYNPFIELDS.
*20110905 BY SM
CLEAR IT_TMP.
REFRESH IT_TMP.
CLEAR IT_RET.
REFRESH IT_RET.
*20110905 BY SM
IF IT_ZST046[] IS NOT INITIAL.
READ TABLE IT_ZST046 index L_LINE.
IF ZST046-MATNRO IS INITIAL.
ZST046-MATNRO = IT_ZST046-MATNRO.
ENDIF.
IF ZST046-MATNRC IS INITIAL.
ZST046-MATNRC = IT_ZST046-MATNRC.
ENDIF.
IF ZST046-ZGROUP IS INITIAL.
ZST046-ZGROUP = IT_ZST046-ZGROUP.
ENDIF.
IF ZST046-LEDC IS INITIAL.
ZST046-LEDC = IT_ZST046-LEDC.
ENDIF.
ENDIF.
*20100913 BY SM 維持抓既有的ZST045資料,若有異動,USER自行手動修改
* SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_TMP
* FROM ZST045
* WHERE VBELN = LIPS-VGBEL
* AND POSNR = LIPS-VGPOS
**20101022 BY SM
* AND KUNNR = LIKP-KUNAG "sold-to-party
* AND MATNR = LIPS-MATNR.
IF ZST046-ZGROUP IS NOT INITIAL AND ZST046-LEDC IS NOT INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_TMP
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND KUNNR = LIKP-KUNNR
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC
AND ZGROUP = ZST046-ZGROUP
AND LEDC = ZST046-LEDC.
ELSEIF ZST046-ZGROUP IS NOT INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_TMP
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND KUNNR = LIKP-KUNNR
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC
AND ZGROUP = ZST046-ZGROUP.
ELSEIF ZST046-LEDC IS NOT INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_TMP
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND KUNNR = LIKP-KUNNR
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC
AND LEDC = ZST046-LEDC.
ELSEIF ZST046-MATNRO IS INITIAL AND ZST046-MATNRC IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_TMP
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND KUNNR = LIKP-KUNNR
AND MATNR = LIPS-MATNR.
ENDIF.
IF SY-SUBRC = 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'SEQNO'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'ZST046-SEQNO'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_TMP
RETURN_TAB = IT_RET.
IF IT_RET[] IS NOT INITIAL.
READ TABLE IT_TMP WITH KEY SEQNO = IT_RET-FIELDVAL.
*20110905 BY SM
IT_DYNPFIELDS-FIELDNAME = IT_RET-RETFIELD.
IT_DYNPFIELDS-FIELDVALUE = IT_RET-FIELDVAL.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*20100913 BY SM 因為改用SEQNO當KEY ,所以要多抓對外料號欄位MATNRO,否則若重新選擇後該項次不會更新,若有兩個項次以上則會空白
IT_DYNPFIELDS-FIELDNAME = 'ZST046-MATNRO'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-MATNRO.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*
* SORT IT_ZST046 BY POSNR SEQNO DESCENDING.
* READ TABLE IT_ZST046 WITH KEY POSNR = LIPS-POSNR.
*20100910 BY SM MARK LINE 131-133 解決序號問題
* L_CVTN = IT_ZST046-SEQNO + 1.
* IT_DYNPFIELDS-FIELDVALUE = L_CVTN.
* IT_TMP-SEQNO = L_CVTN.
* IT_DYNPFIELDS-STEPL = L_LINE.
* APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-MATNRC'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-MATNRC.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-ZGROUP'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-ZGROUP.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-LEDC'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-LEDC.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*20110905 BY SM
* IT_DYNPFIELDS-FIELDNAME = 'ZST046-CHPCAT'.
* IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CHPCAT.
* IT_DYNPFIELDS-STEPL = L_LINE.
* APPEND IT_DYNPFIELDS.
* IT_DYNPFIELDS-FIELDNAME = 'ZST046-IVULMT'.
* IT_DYNPFIELDS-FIELDVALUE = IT_TMP-IVULMT.
* IT_DYNPFIELDS-STEPL = L_LINE.
* APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-SEQNO'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-SEQNO.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*20110905 BY SM
SORT IT_ZST046 BY POSNR SEQNO DESCENDING.
READ TABLE IT_ZST046 WITH KEY POSNR = LIPS-POSNR.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-FLAG'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-FLAG.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-IVMIN'.
L_COVT = IT_TMP-IVMIN.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-IVMAX'.
L_COVT = IT_TMP-IVMAX.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*20110905 BY SM
* IT_DYNPFIELDS-FIELDNAME = 'ZST046-VFULMT'.
* IT_DYNPFIELDS-FIELDVALUE = IT_TMP-VFULMT.
* IT_DYNPFIELDS-STEPL = L_LINE.
* APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-VFMIN'.
L_COVT = IT_TMP-VFMIN.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-VFMAX'.
L_COVT = IT_TMP-VFMAX.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*20110905
* IT_DYNPFIELDS-FIELDNAME = 'ZST046-WDULMT'.
* IT_DYNPFIELDS-FIELDVALUE = IT_TMP-WDULMT.
* IT_DYNPFIELDS-STEPL = L_LINE.
* APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-WDMIN'.
L_COVT = IT_TMP-WDMIN.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-WDMAX'.
L_COVT = IT_TMP-WDMAX.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*2011905 BY SM
* IT_DYNPFIELDS-FIELDNAME = 'ZST046-CTULMT'.
* IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CTULMT.
* IT_DYNPFIELDS-STEPL = L_LINE.
* APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CCTMIN'.
L_COVT = IT_TMP-CCTMIN.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CCTMAX'.
L_COVT = IT_TMP-CCTMAX.
IT_DYNPFIELDS-FIELDVALUE = L_COVT.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE1'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE1.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE2'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE2.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE3'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE3.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE4'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE4.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE5'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE5.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE6'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE6.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE7'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE7.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE8'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE8.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE9'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE9.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE10'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE10.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE11'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE11.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE12'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE12.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE13'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE13.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE14'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE14.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE15'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE15.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
IT_DYNPFIELDS-FIELDNAME = 'ZST046-CIE16'.
IT_DYNPFIELDS-FIELDVALUE = IT_TMP-CIE16.
IT_DYNPFIELDS-STEPL = L_LINE.
APPEND IT_DYNPFIELDS.
*20110905 BY SM
* DELETE IT_ZST046 WHERE POSNR = LIPS-POSNR AND SEQNO = L_SEQNO.
DELETE IT_ZST046
WHERE MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC
AND ZGROUP = ZST046-ZGROUP
AND LEDC = ZST046-LEDC
AND POSNR = LIPS-POSNR
AND SEQNO = L_SEQNO.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = IT_DYNPFIELDS.
MOVE-CORRESPONDING IT_TMP TO ZST046.
ZST046-VBELN = LIKP-VBELN.
ZST046-POSNR = LIPS-POSNR.
ZST046-MATNR = LIPS-MATNR.
ZST046-KUNNR = LIKP-KUNNR.
MOVE-CORRESPONDING ZST046 TO IT_ZST046.
APPEND IT_ZST046.
CLEAR IT_ZST046.
ENDIF.
ENDIF.
ENDMODULE. " VALUE_ZST046_SEQNO_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_MATNRO_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_MATNRO_INPUT INPUT.
DATA: BEGIN OF IT_MATNRO OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
END OF IT_MATNRO.
DATA: IT_MATNRO_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT DISTINCT KUNNR MATNRO INTO CORRESPONDING FIELDS OF TABLE IT_MATNRO
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNRO'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_MATNRO'
value_org = 'S'
TABLES
value_tab = IT_MATNRO
return_tab = IT_MATNRO_RET.
ZST046-MATNRO = IT_MATNRO_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_MATNRO_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_MATNRC_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_MATNRC_INPUT INPUT.
DATA: BEGIN OF IT_MATNRC OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
MATNRC LIKE ZST045-MATNRC,
END OF IT_MATNRC.
DATA: IT_MATNRC_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT DISTINCT KUNNR MATNRO MATNRC INTO CORRESPONDING FIELDS OF TABLE IT_MATNRC
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNRC'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_MATNRC'
value_org = 'S'
TABLES
value_tab = IT_MATNRC
return_tab = IT_MATNRC_RET.
ZST046-MATNRC = IT_MATNRC_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_MATNRC_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_ZGROUP_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_ZGROUP_INPUT INPUT.
DATA: BEGIN OF IT_ZGROUP OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
MATNRC LIKE ZST045-MATNRC,
ZGROUP LIKE ZST045-ZGROUP,
SEQNO LIKE ZST045-SEQNO,
MATNR LIKE ZST045-MATNR,
LEDC LIKE ZST045-LEDC,
IVMIN LIKE ZST045-IVMIN,
IVMAX LIKE ZST045-IVMAX,
VFMIN LIKE ZST045-VFMIN,
VFMAX LIKE ZST045-VFMAX,
CIE1 LIKE ZST045-CIE1,
CIE2 LIKE ZST045-CIE2,
CIE3 LIKE ZST045-CIE3,
CIE4 LIKE ZST045-CIE4,
WDMIN LIKE ZST045-WDMIN,
WDMAX LIKE ZST045-WDMAX,
CCTMIN LIKE ZST045-CCTMIN,
CCTMAX LIKE ZST045-CCTMAX,
END OF IT_ZGROUP.
DATA: IT_ZGROUP_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_ZGROUP
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ZGROUP'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_ZGROUP'
value_org = 'S'
TABLES
value_tab = IT_ZGROUP
return_tab = IT_ZGROUP_RET.
ZST046-ZGROUP = IT_ZGROUP_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_ZGROUP_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_LEDC_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_LEDC_INPUT INPUT.
DATA: BEGIN OF IT_LEDC OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
MATNRC LIKE ZST045-MATNRC,
ZGROUP LIKE ZST045-ZGROUP,
SEQNO LIKE ZST045-SEQNO,
MATNR LIKE ZST045-MATNR,
LEDC LIKE ZST045-LEDC,
IVMIN LIKE ZST045-IVMIN,
IVMAX LIKE ZST045-IVMAX,
VFMIN LIKE ZST045-VFMIN,
VFMAX LIKE ZST045-VFMAX,
CIE1 LIKE ZST045-CIE1,
CIE2 LIKE ZST045-CIE2,
CIE3 LIKE ZST045-CIE3,
CIE4 LIKE ZST045-CIE4,
WDMIN LIKE ZST045-WDMIN,
WDMAX LIKE ZST045-WDMAX,
CCTMIN LIKE ZST045-CCTMIN,
CCTMAX LIKE ZST045-CCTMAX,
END OF IT_LEDC.
DATA: IT_LEDC_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_LEDC
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'LEDC'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_LEDC'
value_org = 'S'
TABLES
value_tab = IT_LEDC
return_tab = IT_LEDC_RET.
ZST046-LEDC = IT_LEDC_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_LEDC_INPUT INPUT
MODULE VALUE_ZST046_MATNRO_INPUT INPUT.
DATA: BEGIN OF IT_MATNRO OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
END OF IT_MATNRO.
DATA: IT_MATNRO_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT DISTINCT KUNNR MATNRO INTO CORRESPONDING FIELDS OF TABLE IT_MATNRO
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNRO'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_MATNRO'
value_org = 'S'
TABLES
value_tab = IT_MATNRO
return_tab = IT_MATNRO_RET.
ZST046-MATNRO = IT_MATNRO_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_MATNRO_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_MATNRC_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_MATNRC_INPUT INPUT.
DATA: BEGIN OF IT_MATNRC OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
MATNRC LIKE ZST045-MATNRC,
END OF IT_MATNRC.
DATA: IT_MATNRC_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT DISTINCT KUNNR MATNRO MATNRC INTO CORRESPONDING FIELDS OF TABLE IT_MATNRC
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNRC'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_MATNRC'
value_org = 'S'
TABLES
value_tab = IT_MATNRC
return_tab = IT_MATNRC_RET.
ZST046-MATNRC = IT_MATNRC_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_MATNRC_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_ZGROUP_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_ZGROUP_INPUT INPUT.
DATA: BEGIN OF IT_ZGROUP OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
MATNRC LIKE ZST045-MATNRC,
ZGROUP LIKE ZST045-ZGROUP,
SEQNO LIKE ZST045-SEQNO,
MATNR LIKE ZST045-MATNR,
LEDC LIKE ZST045-LEDC,
IVMIN LIKE ZST045-IVMIN,
IVMAX LIKE ZST045-IVMAX,
VFMIN LIKE ZST045-VFMIN,
VFMAX LIKE ZST045-VFMAX,
CIE1 LIKE ZST045-CIE1,
CIE2 LIKE ZST045-CIE2,
CIE3 LIKE ZST045-CIE3,
CIE4 LIKE ZST045-CIE4,
WDMIN LIKE ZST045-WDMIN,
WDMAX LIKE ZST045-WDMAX,
CCTMIN LIKE ZST045-CCTMIN,
CCTMAX LIKE ZST045-CCTMAX,
END OF IT_ZGROUP.
DATA: IT_ZGROUP_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_ZGROUP
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ZGROUP'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_ZGROUP'
value_org = 'S'
TABLES
value_tab = IT_ZGROUP
return_tab = IT_ZGROUP_RET.
ZST046-ZGROUP = IT_ZGROUP_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_ZGROUP_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module VALUE_ZST046_LEDC_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE VALUE_ZST046_LEDC_INPUT INPUT.
DATA: BEGIN OF IT_LEDC OCCURS 0,
KUNNR LIKE ZST045-KUNNR,
MATNRO LIKE ZST045-MATNRO,
MATNRC LIKE ZST045-MATNRC,
ZGROUP LIKE ZST045-ZGROUP,
SEQNO LIKE ZST045-SEQNO,
MATNR LIKE ZST045-MATNR,
LEDC LIKE ZST045-LEDC,
IVMIN LIKE ZST045-IVMIN,
IVMAX LIKE ZST045-IVMAX,
VFMIN LIKE ZST045-VFMIN,
VFMAX LIKE ZST045-VFMAX,
CIE1 LIKE ZST045-CIE1,
CIE2 LIKE ZST045-CIE2,
CIE3 LIKE ZST045-CIE3,
CIE4 LIKE ZST045-CIE4,
WDMIN LIKE ZST045-WDMIN,
WDMAX LIKE ZST045-WDMAX,
CCTMIN LIKE ZST045-CCTMIN,
CCTMAX LIKE ZST045-CCTMAX,
END OF IT_LEDC.
DATA: IT_LEDC_RET TYPE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_LEDC
FROM ZST045
WHERE VBELN = LIPS-VGBEL
AND POSNR = LIPS-VGPOS
AND MATNR = LIPS-MATNR
AND MATNRO = ZST046-MATNRO
AND MATNRC = ZST046-MATNRC.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'LEDC'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ZST046_LEDC'
value_org = 'S'
TABLES
value_tab = IT_LEDC
return_tab = IT_LEDC_RET.
ZST046-LEDC = IT_LEDC_RET-FIELDVAL.
ENDMODULE. " VALUE_ZST046_LEDC_INPUT INPUT
BADI_SD_TAB_CUST_H
Tab Page for Own Details - Header Detail Order
要在Sales Order新增tab時使用
ACTIVATE_TAB_PAGE
TRANSFER_DATA_TO_SUBSCREEN
TRANSFER_DATA_FROM_SUBSCREEN
PASS_FCODE_TO_SUBSCREEN
要在Sales Order新增tab時使用
ACTIVATE_TAB_PAGE
TRANSFER_DATA_TO_SUBSCREEN
TRANSFER_DATA_FROM_SUBSCREEN
PASS_FCODE_TO_SUBSCREEN
ZCL_IM_SHP_TAB_CUST_ITEM
客製DN new tab
METHOD IF_EX_LE_SHP_TAB_CUST_ITEM~ACTIVATE_TAB_PAGE .
DATA: CHINAORDERTYPE TYPE EKKO-CHINAORDERTYPE.
FIELD-SYMBOLS: <LS_XLIPS> TYPE LIPSVB.
CASE IS_LIKP-LFART.
WHEN 'NL' OR 'NLR'.
READ TABLE IT_XLIPS ASSIGNING <LS_XLIPS>
WITH KEY VBELN = IS_LIKP-VBELN.
CHECK SY-SUBRC EQ 0.
SELECT CHINAORDERTYPE INTO CHINAORDERTYPE FROM EKKO
WHERE EBELN EQ <LS_XLIPS>-VGBEL.
EXIT.
ENDSELECT.
IF SY-SUBRC EQ 0.
CASE CHINAORDERTYPE.
WHEN '3'.
IF IS_LIKP-LFART EQ 'NLR'.
EF_CAPTION = 'Goods Movement Data'.
EF_POSITION = 11.
EF_PROGRAM = 'SAPLZM008'.
EF_DYNPRO = '2000'.
ENDIF.
WHEN 'D'.
EF_CAPTION = 'Goods Movement Data'.
EF_POSITION = 11.
EF_PROGRAM = 'SAPLZM008'.
EF_DYNPRO = '1000'.
ENDCASE.
ENDIF.
ENDCASE.
EF_CAPTION = 'LED Specification'.
EF_POSITION = 12.
EF_PROGRAM = 'SAPLZM008'.
EF_DYNPRO = '3000'.
ENDMETHOD.
METHOD IF_EX_LE_SHP_TAB_CUST_ITEM~TRANSFER_DATA_TO_SUBSCREEN .
CASE IS_LIKP-LFART.
WHEN 'NL' OR 'NLR'.
CALL FUNCTION 'Z_SHPTAB_ITEM_GR_PUSH'
EXPORTING
IM_LIPS = IS_LIPS
IM_TRANTYPE = IF_TRTYP.
ENDCASE.
CALL FUNCTION 'Z_SHPTAB_ITEM_GR_PUSH'
EXPORTING
IM_LIPS = IS_LIPS
IM_TRANTYPE = IF_TRTYP
IM_LIKP = IS_LIKP
TABLES
IT_XLIPS = IT_XLIPS.
ENDMETHOD.
FUNCTION Z_SHPTAB_ITEM_GR_PUSH.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(IM_LIPS) TYPE LIPS
*" REFERENCE(IM_TRANTYPE) TYPE TRTYP
*" REFERENCE(IM_LIKP) TYPE LIKP
*" TABLES
*" IT_XLIPS TYPE SHP_LIPS_T OPTIONAL
*"----------------------------------------------------------------------
LIPS-REFDOCNR = IM_LIPS-REFDOCNR.
LIPS-REFDOCITEM = IM_LIPS-REFDOCITEM.
TRANTYPE = IM_TRANTYPE.
MOVE-CORRESPONDING IM_LIPS TO LIPS.
MOVE-CORRESPONDING IM_LIKP TO LIKP.
IT_LIPS[] = IT_XLIPS[].
IMPORT IT_ZST046 FROM MEMORY ID 'ZST046'.
FREE MEMORY ID 'ZST046'.
*20101110 BY SM IF IT_ZST046[] IS INITIAL.
LOOP AT IT_LIPS INTO WA_LIPSVB.
*20110119 BY SM 找不到DN及ITEM 的才從ZST045讀取
READ TABLE IT_ZST046 WITH KEY POSNR = WA_LIPSVB-POSNR "因為VL01N進來時不會有DN NO.
MATNR = WA_LIPSVB-MATNR. "若該項次有異動料號時也要能判斷正確
* READ TABLE IT_ZST046 WITH KEY VBELN = WA_LIPSVB-VBELN
* POSNR = WA_LIPSVB-POSNR.
IF SY-SUBRC = 4. "找不到的才從ZST045讀取
*20110119 BY SM 若是找不到,有可能是該項次料號異動,該item在IT_ZST046 & ZST046的資料要刪除
*否則會有Double item資料的情形
DELETE IT_ZST046 WHERE POSNR = WA_LIPSVB-POSNR.
* MODIFY IT_ZST046.
DELETE FROM ZST046 WHERE VBELN = WA_LIPSVB-VBELN AND POSNR = WA_LIPSVB-POSNR.
SELECT *
INTO CORRESPONDING FIELDS OF IT_ZST046
FROM ZST045
WHERE VBELN = WA_LIPSVB-VGBEL
AND POSNR = WA_LIPSVB-VGPOS
*20101022 BY SM 增加客戶及料號判斷,才可以抓到正確的資料
AND KUNNR = IM_LIKP-KUNAG
AND MATNR = WA_LIPSVB-MATNR.
IT_ZST046-VBELN = WA_LIPSVB-VBELN.
IT_ZST046-POSNR = WA_LIPSVB-POSNR.
APPEND IT_ZST046.
ENDSELECT.
ENDIF. " END OF 找不到的才從ZST045讀取
ENDLOOP.
*20101110 ENDIF.
ENDFUNCTION.
FUNCTION Z_SHPTAB_ITEM_GR_PUSH.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(IM_LIPS) TYPE LIPS
*" REFERENCE(IM_TRANTYPE) TYPE TRTYP
*" REFERENCE(IM_LIKP) TYPE LIKP
*" TABLES
*" IT_XLIPS TYPE SHP_LIPS_T OPTIONAL
*"----------------------------------------------------------------------
LIPS-REFDOCNR = IM_LIPS-REFDOCNR.
LIPS-REFDOCITEM = IM_LIPS-REFDOCITEM.
TRANTYPE = IM_TRANTYPE.
MOVE-CORRESPONDING IM_LIPS TO LIPS.
MOVE-CORRESPONDING IM_LIKP TO LIKP.
IT_LIPS[] = IT_XLIPS[].
IMPORT IT_ZST046 FROM MEMORY ID 'ZST046'.
FREE MEMORY ID 'ZST046'.
*20101110 BY SM IF IT_ZST046[] IS INITIAL.
LOOP AT IT_LIPS INTO WA_LIPSVB.
*20110119 BY SM 找不到DN及ITEM 的才從ZST045讀取
READ TABLE IT_ZST046 WITH KEY POSNR = WA_LIPSVB-POSNR "因為VL01N進來時不會有DN NO.
MATNR = WA_LIPSVB-MATNR. "若該項次有異動料號時也要能判斷正確
* READ TABLE IT_ZST046 WITH KEY VBELN = WA_LIPSVB-VBELN
* POSNR = WA_LIPSVB-POSNR.
IF SY-SUBRC = 4. "找不到的才從ZST045讀取
*20110119 BY SM 若是找不到,有可能是該項次料號異動,該item在IT_ZST046 & ZST046的資料要刪除
*否則會有Double item資料的情形
DELETE IT_ZST046 WHERE POSNR = WA_LIPSVB-POSNR.
* MODIFY IT_ZST046.
DELETE FROM ZST046 WHERE VBELN = WA_LIPSVB-VBELN AND POSNR = WA_LIPSVB-POSNR.
SELECT *
INTO CORRESPONDING FIELDS OF IT_ZST046
FROM ZST045
WHERE VBELN = WA_LIPSVB-VGBEL
AND POSNR = WA_LIPSVB-VGPOS
*20101022 BY SM 增加客戶及料號判斷,才可以抓到正確的資料
AND KUNNR = IM_LIKP-KUNAG
AND MATNR = WA_LIPSVB-MATNR.
IT_ZST046-VBELN = WA_LIPSVB-VBELN.
IT_ZST046-POSNR = WA_LIPSVB-POSNR.
APPEND IT_ZST046.
ENDSELECT.
ENDIF. " END OF 找不到的才從ZST045讀取
ENDLOOP.
*20101110 ENDIF.
ENDFUNCTION.
method if_ex_le_shp_tab_cust_item~transfer_data_from_subscreen .
* case cs_likp-lfart.
* when 'NL' or 'NLR'.
call function 'Z_SHPTAB_ITEM_GR_POP'
IMPORTING
ex_lips = cs_lips.
* endcase.
endmethod.
function z_shptab_item_gr_pop.
*"----------------------------------------------------------------------
*"*"Local interface:
*" EXPORTING
*" REFERENCE(EX_LIPS) TYPE LIPS
*"----------------------------------------------------------------------
*ex_lips-refdocnr = lips-refdocnr.
*ex_lips-refdocitem = lips-refdocitem.
free memory id 'ZST046'.
export it_zst046 to memory id 'ZST046'.
endfunction.
訂閱:
文章 (Atom)