*&---------------------------------------------------------------------*
*& Report ZTR_DEMO_REPORT21 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZTR_DEMO_REPORT21 .
DATA : BEGIN OF ITAB OCCURS 0,
bukrs like t001-bukrs,
f1(10) type c,
F2 TYPE I,
end of itab.
BREAK-POINT.
itab-bukrs = '1000'.
itab-f1 = 'AB'.
itab-f2 = '100'.
append itab.
itab-bukrs = '1000'.
itab-f1 = 'AB'.
itab-f2 = '150'.
append itab.
itab-bukrs = '1000'.
itab-f1 = 'AB'.
itab-f2 = '200'.
append itab.
itab-bukrs = '1000'.
itab-f1 = 'ABC'.
itab-f2 = '210'.
append itab.
itab-bukrs = '1000'.
itab-f1 = 'ABC'.
itab-f2 = '220'.
append itab.
itab-bukrs = '1000'.
itab-f1 = 'AB'.
itab-f2 = '230'.
append itab.
itab-bukrs = '1000'.
itab-f1 = 'CD'.
itab-f2 = '250'.
append itab.
itab-bukrs = '1100'.
itab-f1 = 'AB'.
itab-f2 = '110'.
append itab.
itab-bukrs = '1100'.
itab-f1 = 'CD'.
itab-f2 = '120'.
append itab.
itab-bukrs = '1100'.
itab-f1 = 'CD'.
itab-f2 = '130'.
append itab.
itab-bukrs = '1200'.
itab-f1 = 'AB'.
itab-f2 = '120'.
append itab.
SORT ITAB BY BUKRS F1 .
skip 1 .
Write :/5 'At new '.
skip 1 .
*------------ AT NEW
write :/5 'Plant', 20 'F1' , 40 'Price'. .
SKIP 1.
BREAK-POINT.
loop at itab.
at new bukrs.
write :/5 itab-bukrs, 70 'AT NEW EVENT PLANT ' .
endat.
write:/20 itab-f1 , 30 itab-f2.
at end of BUKRS .
sum .
write:/1 sy-uline.
WRITE:/30 ITAB-F2, 70 'AT End of event'.
SKIP .
ENDAT.
*WRITE:/30 ITAB-F2.
at last .
skip 1 .
write:/1 sy-uline.
sum .
WRITE:/30 ITAB-F2 , 70 'AT LAST EVENT'.
endat.
endloop.
*------------ AT ONCHANGE
SKIP 3 .
Write :/5 'On change of '.
SKIP 3 .
write :/5 'Plant', 20 'F1' , 40 'Price'.
SKIP 1.
BREAK-POINT.
loop at itab.
ON CHANGE OF ITAB-BUKRS or ITAB-f1.
write :/5 itab-bukrs , 20 itab-f1 .
ENDON.
write:/30 itab-f2.
*SUM ."ITAB-F2 .
*write:/30 itab-f2.
*
at end of BUKRS .
skip 1 .
write:/1 sy-uline.
sum .
WRITE:/30 ITAB-F2, 70 'AT End of event'.
SKIP .
ENDAT.
at last .
skip 1 .
write:/1 sy-uline.
sum .
WRITE:/30 ITAB-F2 , 70 'AT LAST EVENT'.
endat.
endloop.
**------------ AT ONCHANGE
*
*
*SKIP 3 .
*Write :/5 'On change of '.
*SKIP 3 .
*
*write :/5 'Plant', 20 'F1' , 40 'Price'.
*SKIP 1.
*
*loop at itab.
*
**at end of bukrs .
**
**sum .
**
**write:/5 itab-bukrs ,30 itab-f2.
**
**endat .
*
*ON CHANGE OF ITAB-BUKRS .
*
**sum .
*
*write:/5 itab-bukrs ,30 itab-f2.
*
*ENDON.
*
*
*endloop.
No comments:
Post a Comment