Google Search - Blog...........

ABAP - Simple List Interactive Report Program.

REPORT zintractive .

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.


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.
ULINE.
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.

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.

LOOP AT it_final INTO wa_final.
WRITE :
/1 wa_final-matnr
COLOR 2,
20 wa_final-ersda ,
37 wa_final-ernam,
50 wa_final-laeda ,
70 wa_final-mtart ,
85 wa_final-matkl ,
95 wa_final-meins,
115 wa_final-lgort ,
130 wa_final-werks .
ENDLOOP.

TOP-OF-PAGE.
WRITE : /1 'MATERIAL NO' COLOR 1,
40 'DISCRIPTION' COLOR 2.
ULINE .

No comments:

Post a Comment