Collect Statement
DATA : BEGIN OF ITAB OCCURS 0,
COL1(3) TYPE C,
COL2 TYPE I,
END OF ITAB.
ITAB-COL1 = 'ABC'.
ITAB-COL2 = 50.
COLLECT ITAB.
ITAB-COL1 = 'ABC'.
ITAB-COL2 = 100.
COLLECT ITAB.
ITAB-COL1 = 'ABC'.
ITAB-COL2 = 150.
COLLECT ITAB.
ITAB-COL1 = 'PQR'.
ITAB-COL2 = 100.
COLLECT ITAB.
ITAB-COL1 = 'PQR'.
ITAB-COL2 = 100.
COLLECT ITAB.
ITAB-COL1 = 'XYZ'.
ITAB-COL2 = 200.
COLLECT ITAB.
LOOP AT ITAB.
WRITE : / ITAB-COL1, ITAB-COL2.
ENDLOOP.
SORT ITAB.
LOOP AT ITAB.
AT FIRST.
WRITE: / 'AT NEW STATEMENT'.
ULINE.
ENDAT.
AT NEW COL1.
WRITE: / ' AT FIRST OF :', ITAB-COL1.
ENDAT.
WRITE : / ITAB-COL1, ITAB-COL2.
AT LAST.
ULINE.
ENDAT.
ENDLOOP.
No comments:
Post a Comment