*&--------------------------------------------------------------
*& Form set_item_table_initial_line
*&--------------------------------------------------------------
FORM. SET_ITEM_TABLE_INITIAL_LINE.
DATA: DATALINE TYPE I,
TARGLINE TYPE I,
NEWDLINE TYPE I.
TARGLINE = ITEMCTRL-TOP_LINE + 12 - 1.
DESCRIBE TABLE ZCM04TAB LINES DATALINE.
NEWDLINE = TARGLINE - DATALINE.
DO NEWDLINE TIMES.
CLEAR ZCM04TAB.
ADD 1 TO LASTDOCITEM.
ZCM04TAB-DOCITEM = LASTDOCITEM.
APPEND ZCM04TAB. CLEAR ZCM04TAB.
ENDDO.
DESCRIBE TABLE ZCM04TAB LINES ITEMCTRL-LINES.
ENDFORM. " set_item_table_initial_line
*&--------------------------------------------------------------
*& Module write_item_data INPUT
*&--------------------------------------------------------------
MODULE WRITE_ITEM_DATA INPUT.
DATA: L_CHARG LIKE ZCM04-CHARG,
L_ECODE LIKE SY-SUBRC.
DATA: T_ENMNG LIKE RESB-ENMNG,
T_BDMNG LIKE RESB-BDMNG.
READ TABLE ZCM04TAB INDEX ITEMCTRL-CURRENT_LINE
TRANSPORTING UPTINDICATOR.
READ TABLE ZCM04TAB INTO ZCM04WA INDEX ITEMCTRL-CURRENT_LINE.
MOVE-CORRESPONDING ZCM04 TO ZCM04TAB.
*Elven20070117 add
IF ZCM04TAB-UMWRK EQ '' AND '8' NE ZCM03-DOCTYPE.
ZCM04TAB-UMWRK = ZCM04WA-WERKS .
ENDIF .
*Ting 090715 begin
IF ZCM04TAB-UMWRK EQ '' AND 'B' NE ZCM03-DOCTYPE.
ZCM04TAB-UMWRK = ZCM04WA-WERKS .
ENDIF .
*Ting 090715 end
* IF '8' EQ ZCM03-DOCTYPE.
* ZCM04TAB-UMWRK = ZCM04WA-WERKS .
* ENDIF .
*Ting 090715 begin
IF '8' EQ ZCM03-DOCTYPE OR '14' EQ ZCM03-DOCTYPE OR
'15' EQ ZCM03-DOCTYPE OR 'B' EQ ZCM03-DOCTYPE.
ZCM04TAB-UMWRK = ZCM04-WERKS .
ENDIF .
*Ting 090715 end
*Echo 100624.add.sn
IF '1' EQ ZCM03-DOCTYPE.
SELECT SUM( RESB~ENMNG ) SUM( RESB~BDMNG )
INTO (T_ENMNG,T_BDMNG)
FROM RESB
INNER JOIN AFKO ON RESB~RSNUM = AFKO~RSNUM
WHERE AFKO~AUFNR EQ ZCM03-AUFNR
AND RESB~MATNR EQ ZCM04TAB-MATNR
AND RESB~RGEKZ NE 'X' AND RESB~XLOEK NE 'X'
AND RESB~SCHGT NE 'X' AND RESB~DUMPS NE 'X'.
ZCM04TAB-ERFMG = T_BDMNG - T_ENMNG.
ZCM04TAB-PLFMG = ZCM04TAB-ERFMG.
CLEAR: T_BDMNG,T_ENMNG.
ENDIF.
*Echo 100624.add.en
* IF '4' EQ ZCM03-DOCTYPE.
* ZCM04TAB-UMCHA = ZCM04WA-CHARG.
* ZCM04TAB-UMMAT = ZCM04WA-MATNR.
* ENDIF .
IF '4' EQ ZCM03-DOCTYPE.
ZCM04TAB-UMCHA = ZCM04-CHARG.
ZCM04TAB-UMMAT = ZCM04-MATNR.
ENDIF.
IF '4' NE ZCM03-DOCTYPE AND 'I' NE ZCM03-DOCTYPE AND
'J' NE ZCM03-DOCTYPE AND 'L' NE ZCM03-DOCTYPE AND
'K' NE ZCM03-DOCTYPE.
ZCM04TAB-UMLGO = ZCM04-LGORT .
ENDIF.
IF 'I' = ZCM03-DOCTYPE OR 'J' = ZCM03-DOCTYPE .
ZCM04TAB-UMCHA = ZCM04-CHARG.
ENDIF.
ZCM04TAB-RSNUM = ZCM04WA-RSNUM.
ZCM04TAB-RSPOS = ZCM04WA-RSPOS.
*Elven20070117 add end.
IF ZCM04TAB-UPTINDICATOR EQ SPACE.
IF ZCM04 NE ZCM04WA.
ZCM04TAB-UPTINDICATOR = 'X'.
ENDIF.
ENDIF.
IF ZCM04TAB-MATNR <> ''.
IF ZCM04TAB-CHARG = ''.
CALL FUNCTION 'ZRFC_PP_PCE_0008'
EXPORTING
H_MATNR = ZCM04TAB-MATNR
H_WERKS = ZCM04TAB-WERKS
IMPORTING
H_CHARG = ZCM04TAB-CHARG.
*----------JL100201.so
* select revlv andat into (zcm04tab-charg,aeoi-andat)
* from aeoi
* where bjkt = zcm04tab-matnr
* order by andat descending.
* exit.
* endselect.
*----------JL100201.eo
ENDIF.
*Echo 20090812 add check valuation type.bn
IF ZCM04TAB-CHARG EQ SPACE.
CALL FUNCTION 'ZRFC_MM_PCE_0054'
EXPORTING
PLANT = ZCM04TAB-WERKS
PARTNO = ZCM04TAB-MATNR
SLOC = ZCM04TAB-LGORT
IMPORTING
ECODE = L_ECODE
VALUATION_TYPE = L_CHARG.
IF L_ECODE = 0.
ZCM04TAB-CHARG = L_CHARG.
ENDIF.
CLEAR L_CHARG.
ENDIF.
*Echo 20090812 add check valuation type.bn
*Ariel 20090815 add check valuation type for receiving Material---*
IF ZCM04TAB-UMMAT NE SPACE AND ZCM04TAB-UMCHA EQ SPACE.
CLEAR L_CHARG.
CALL FUNCTION 'ZRFC_MM_PCE_0054'
EXPORTING
PLANT = ZCM04TAB-UMWRK
PARTNO = ZCM04TAB-UMMAT
SLOC = ZCM04TAB-UMLGO
IMPORTING
ECODE = L_ECODE
VALUATION_TYPE = L_CHARG.
IF L_ECODE = 0.
ZCM04TAB-UMCHA = L_CHARG.
ENDIF.
ENDIF.
*Ariel 20090815 add ending ----------------------------------------*
IF ZCM04TAB-ERFME = ''.
SELECT SINGLE MEINS FROM MARA INTO ZCM04TAB-ERFME
WHERE MATNR = ZCM04TAB-MATNR.
ENDIF.
ENDIF.
*Ariel add 20100423.sn for epd2 get altGroup again---*
ZCM04TAB-ZALPGR = ZCM04WA-ZALPGR.
*Ariel add 20100423.en add ending-----------------*
MODIFY ZCM04TAB INDEX ITEMCTRL-CURRENT_LINE.
ENDMODULE. " write_item_data INPUT
*&--------------------------------------------------------------
*& Module set_data_input_flag INPUT
*&--------------------------------------------------------------
MODULE SET_DATA_INPUT_FLAG INPUT.
PERFORM. SET_DATA_INPUT_FLAG.
ENDMODULE. " set_data_input_flag INPUT
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14397246/viewspace-666153/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14397246/viewspace-666153/