*&---------------------------------------------------------------------*
*& Report ZTR_DEMO_REPORT10 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZTR_DEMO_REPORT10 .
TABLES : MARA , MARD , MAKT .
DATA : BEGIN OF ITAB OCCURS 0 ,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
MATKL TYPE MARA-MATKL,
LGORT TYPE MARD-LGORT,
MAKTX TYPE MAKT-MAKTX,
END OF ITAB .
DATA : CHK TYPE C . "AS CHECKBOX .
SELECT M~MATNR M~ERNAM M~MTART D~LGORT K~MAKTX
FROM
MARA AS M INNER JOIN MARD AS D
ON M~MATNR = D~MATNR
INNER JOIN MAKT AS K
ON D~MATNR = K~MATNR
INTO CORRESPONDING FIELDS OF TABLE ITAB .
WRITE :/5 'MATNR' , 35 'ERNAM' , 55 'MTART' , 75 'LGORT'.
ULINE.
LOOP AT ITAB .
WRITE :/2 CHK AS CHECKBOX,
ITAB-MATNR UNDER 'MATNR',
* ITAB-ERNAM UNDER 'ERNAM',
ITAB-MTART UNDER 'MTART'.
* ITAB-LGORT UNDER 'LGORT'.
HIDE ITAB-MATNR.
HIDE ITAB-ERNAM.
HIDE ITAB-LGORT.
ENDLOOP.
DATA : LINE TYPE I .
LINE = SY-LINNO .
AT LINE-SELECTION .
IF SY-LSIND = 1 .
WRITE : /5 'MATNR', 35 'ERNAM' ,75 'LGORT' .
DO LINE TIMES .
READ LINE SY-INDEX FIELD VALUE CHK .
IF CHK = 'X' .
SELECT M~MATNR M~ERNAM D~LGORT
FROM
MARA AS M INNER JOIN MARD AS D
ON M~MATNR = D~MATNR
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE M~MATNR = ITAB-MATNR AND
M~ERNAM = ITAB-ERNAM AND
D~LGORT = ITAB-LGORT .
DELETE ADJACENT DUPLICATES FROM ITAB.
LOOP AT ITAB .
WRITE :/ ITAB-MATNR UNDER 'MATNR',
ITAB-ERNAM UNDER 'ERNAM' ,
ITAB-LGORT UNDER 'LGORT' .
ENDLOOP.
ENDIF .
ENDDO .
ENDIF.
No comments:
Post a Comment