FORM form_get_data TABLES prt_in_tab STRUCTURE itcsy "#EC CALLED
prt_out_tab STRUCTURE itcsy.
* TABLES: LTAP, "#EC NEEDED
* MARA. "#EC NEEDED
TYPES: BEGIN OF LTS_LTAP,
LGNUM TYPE LTAP-LGNUM,
TANUM TYPE LTAP-TANUM,
TAPOS TYPE LTAP-TAPOS,
MAKTX TYPE MAKTX,"MARA-MAKTX,
END OF LTS_LTAP.
DATA: LDT_LTAP TYPE TABLE OF LTS_LTAP,
LDS_LTAP TYPE LTS_LTAP, "ZSEL01002,
LDF_LGNUM LIKE LTAP-LGNUM,
LDF_LGNUM_TMP LIKE LTAP-LGNUM,
LDF_TANUM LIKE LTAP-TANUM,
LDF_TANUM_TMP LIKE LTAP-TANUM,
LDF_TAPOS LIKE LTAP-TAPOS.
DATA: LDS_IN_TAB LIKE LINE OF PRT_IN_TAB.
*
* FIELD-SYMBOLS: <FS_FIELD>,
* <FS_LTAP> LIKE LDT_LTAP,
* <FS_OUT_TAB> TYPE ITCSY.
CONSTANTS: LCF_LGNUM(11) TYPE C VALUE 'LTAP-LGNUM', "WAREHOUSE NUMBER
LCF_TANUM(11) TYPE C VALUE 'LTAP-TANUM', "TO NUMBER
LCF_TAPOS(11) TYPE C VALUE 'LTAP-TAPOS', "TO ORDER ITEM
LCF_MAKTX(11) TYPE C VALUE 'LDF_MAKTX'. "MATERIAL DESCRIPTION
LOOP AT PRT_IN_TAB INTO LDS_IN_TAB.
CASE LDS_IN_TAB-NAME.
WHEN LCF_LGNUM.
MOVE LDS_IN_TAB-VALUE TO LDF_LGNUM.
WHEN LCF_TANUM.
MOVE LDS_IN_TAB-VALUE TO LDF_TANUM.
WHEN LCF_TAPOS.
MOVE LDS_IN_TAB-VALUE TO LDF_TAPOS.
ENDCASE.
ENDLOOP.
IF LDF_LGNUM <> LDF_LGNUM_TMP OR LDF_TANUM <> LDF_TANUM_TMP.
SELECT "Choose the records pertaining to the TO number passed
LGNUM
TANUM
TAPOS
M~MAKTX
INTO CORRESPONDING FIELDS OF TABLE LDT_LTAP
FROM
LTAP AS L
JOIN MAKT AS M
ON M~MATNR EQ L~MATNR
AND M~SPRAS EQ 'E'"SY-LANGU
WHERE L~TANUM EQ LDF_TANUM
AND L~LGNUM EQ LDF_LGNUM.
ENDIF.
MOVE LDF_LGNUM TO LDF_LGNUM_TMP.
MOVE LDF_TANUM TO LDF_TANUM_TMP.
READ TABLE LDT_LTAP WITH KEY
TANUM = LDF_TANUM
TAPOS = LDF_TAPOS
INTO LDS_LTAP.
IF SY-SUBRC = 0.
LOOP AT PRT_OUT_TAB INTO LDS_IN_TAB.
CASE LDS_IN_TAB.
WHEN LCF_MAKTX.
MOVE LDS_LTAP-MAKTX TO LDS_IN_TAB-VALUE.
MODIFY PRT_OUT_TAB FROM LDS_IN_TAB TRANSPORTING VALUE.
ENDCASE.
ENDLOOP.
ENDIF.
ENDFORM. "form_get_data
prt_out_tab STRUCTURE itcsy.
* TABLES: LTAP, "#EC NEEDED
* MARA. "#EC NEEDED
TYPES: BEGIN OF LTS_LTAP,
LGNUM TYPE LTAP-LGNUM,
TANUM TYPE LTAP-TANUM,
TAPOS TYPE LTAP-TAPOS,
MAKTX TYPE MAKTX,"MARA-MAKTX,
END OF LTS_LTAP.
DATA: LDT_LTAP TYPE TABLE OF LTS_LTAP,
LDS_LTAP TYPE LTS_LTAP, "ZSEL01002,
LDF_LGNUM LIKE LTAP-LGNUM,
LDF_LGNUM_TMP LIKE LTAP-LGNUM,
LDF_TANUM LIKE LTAP-TANUM,
LDF_TANUM_TMP LIKE LTAP-TANUM,
LDF_TAPOS LIKE LTAP-TAPOS.
DATA: LDS_IN_TAB LIKE LINE OF PRT_IN_TAB.
*
* FIELD-SYMBOLS: <FS_FIELD>,
* <FS_LTAP> LIKE LDT_LTAP,
* <FS_OUT_TAB> TYPE ITCSY.
CONSTANTS: LCF_LGNUM(11) TYPE C VALUE 'LTAP-LGNUM', "WAREHOUSE NUMBER
LCF_TANUM(11) TYPE C VALUE 'LTAP-TANUM', "TO NUMBER
LCF_TAPOS(11) TYPE C VALUE 'LTAP-TAPOS', "TO ORDER ITEM
LCF_MAKTX(11) TYPE C VALUE 'LDF_MAKTX'. "MATERIAL DESCRIPTION
LOOP AT PRT_IN_TAB INTO LDS_IN_TAB.
CASE LDS_IN_TAB-NAME.
WHEN LCF_LGNUM.
MOVE LDS_IN_TAB-VALUE TO LDF_LGNUM.
WHEN LCF_TANUM.
MOVE LDS_IN_TAB-VALUE TO LDF_TANUM.
WHEN LCF_TAPOS.
MOVE LDS_IN_TAB-VALUE TO LDF_TAPOS.
ENDCASE.
ENDLOOP.
IF LDF_LGNUM <> LDF_LGNUM_TMP OR LDF_TANUM <> LDF_TANUM_TMP.
SELECT "Choose the records pertaining to the TO number passed
LGNUM
TANUM
TAPOS
M~MAKTX
INTO CORRESPONDING FIELDS OF TABLE LDT_LTAP
FROM
LTAP AS L
JOIN MAKT AS M
ON M~MATNR EQ L~MATNR
AND M~SPRAS EQ 'E'"SY-LANGU
WHERE L~TANUM EQ LDF_TANUM
AND L~LGNUM EQ LDF_LGNUM.
ENDIF.
MOVE LDF_LGNUM TO LDF_LGNUM_TMP.
MOVE LDF_TANUM TO LDF_TANUM_TMP.
READ TABLE LDT_LTAP WITH KEY
TANUM = LDF_TANUM
TAPOS = LDF_TAPOS
INTO LDS_LTAP.
IF SY-SUBRC = 0.
LOOP AT PRT_OUT_TAB INTO LDS_IN_TAB.
CASE LDS_IN_TAB.
WHEN LCF_MAKTX.
MOVE LDS_LTAP-MAKTX TO LDS_IN_TAB-VALUE.
MODIFY PRT_OUT_TAB FROM LDS_IN_TAB TRANSPORTING VALUE.
ENDCASE.
ENDLOOP.
ENDIF.
ENDFORM. "form_get_data
No comments:
Post a Comment