Level-2 Interactive Report
REPORT ZREPORT10.
TYPES: BEGIN OF STR_MARD,
MATNR TYPE MARD-MATNR,
LGORT TYPE MARD-LGORT,
WERKS TYPE MARD-WERKS,
END OF STR_MARD.
DATA: WA_MARD TYPE STR_MARD,
IT_MARD TYPE TABLE OF STR_MARD.
TYPES: BEGIN OF STR_MAKT,
MATNR TYPE MAKT-MATNR,
MAKTG TYPE MAKT-MAKTG,
END OF STR_MAKT.
DATA: WA_MAKT TYPE STR_MAKT,
IT_MAKT TYPE TABLE OF STR_MAKT.
TYPES: BEGIN OF STR_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
MTART TYPE MARA-MTART,
MATKL TYPE MARA-MATKL,
MEINS TYPE MARA-MEINS,
END OF STR_MARA.
DATA: WA_MARA TYPE STR_MARA,
IT_MARA TYPE TABLE OF STR_MARA.
TYPES: BEGIN OF STR_FINAL,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
MTART TYPE MARA-MTART,
MATKL TYPE MARA-MATKL,
MEINS TYPE MARA-MEINS,
LGORT TYPE MARD-LGORT,
WERKS TYPE MARD-WERKS,
END OF STR_FINAL.
DATA: WA_FINAL TYPE STR_FINAL,
IT_FINAL TYPE TABLE OF STR_FINAL.
PARAMETERS: PLANT TYPE MARD-WERKS,
STOR LIKE MARD-LGORT.
INITIALIZATION.
PLANT = '1000'.
STOR = '0001'.
START-OF-SELECTION.
SELECT MATNR LGORT WERKS FROM MARD INTO TABLE IT_MARD
WHERE LGORT = STOR AND WERKS = PLANT.
SELECT MATNR MAKTG FROM MAKT
INTO TABLE IT_MAKT FOR ALL ENTRIES IN IT_MARD
WHERE MATNR = IT_MARD-MATNR AND SPRAS = 'E'.
SELECT MATNR ERSDA ERNAM LAEDA MTART MATKL MEINS
FROM MARA INTO TABLE IT_MARA FOR ALL ENTRIES IN IT_MAKT
WHERE MATNR = IT_MAKT-MATNR.
LOOP AT IT_MAKT INTO WA_MAKT.
WRITE : /1 WA_MAKT-MATNR COLOR 1,
40 WA_MAKT-MAKTG COLOR 2.
HIDE WA_MAKT-MATNR.
ENDLOOP.
CLEAR WA_MARD-MATNR.
AT LINE-SELECTION.
REFRESH IT_FINAL.
CLEAR WA_FINAL.
LOOP AT IT_MARA INTO WA_MARA WHERE MATNR = WA_MAKT-MATNR.
WA_FINAL-MATNR = WA_MARA-MATNR.
WA_FINAL-ERSDA = WA_MARA-ERSDA.
WA_FINAL-ERNAM = WA_MARA-ERNAM.
WA_FINAL-LAEDA = WA_MARA-LAEDA.
WA_FINAL-MTART = WA_MARA-MTART.
WA_FINAL-MATKL = WA_MARA-MATKL.
WA_FINAL-MEINS = WA_MARA-MEINS.
READ TABLE IT_MARD INTO WA_MARD WITH KEY MATNR = WA_MAKT-MATNR.
WA_FINAL-LGORT = WA_MARD-LGORT.
WA_FINAL-WERKS = WA_MARD-WERKS.
APPEND WA_FINAL TO IT_FINAL.
ENDLOOP.
SY-LSIND = 1.
LOOP AT IT_FINAL INTO WA_FINAL.
WRITE : / WA_FINAL-MATNR COLOR 2,
20 WA_FINAL-ERSDA COLOR 3,
37 WA_FINAL-ERNAM,
50 WA_FINAL-LAEDA ,
70 WA_FINAL-MTART ,
85 WA_FINAL-MATKL ,
95 WA_FINAL-MEINS,
115 WA_FINAL-LGORT COLOR 4,
130 WA_FINAL-WERKS COLOR 5.
ENDLOOP.
TOP-OF-PAGE.
WRITE : /1 'MATERIAL NO' COLOR 1,
40 'DESCRIPTION' COLOR 2.
ULINE .
TOP-OF-PAGE DURING LINE-SELECTION.
IF SY-LSIND = 1.
WRITE : /1 'MATERIAL NO' COLOR 2,
20 'CREATION DATE' COLOR 3,
32 'PERSON CREATED',
50 'DATE OF LIST' ,
65 'MATERIALTYPE',
80 'MATGROUP' ,
90 'UNITOFMEASURE',
110'STORLOCATION' COLOR 4,
130'PLANT' COLOR 5.
ULINE.
ENDIF.
No comments:
Post a Comment