Lecture 11 “Collect “

*&---------------------------------------------------------------------*
*& Report ZDEMO_CONTROL_BREAK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDEMO_CONTROL_BREAK.
TYPES : BEGIN OF TY_MAkt,
matnr type matnr,
spras type spras,
maktx type maktx,
qty TYPE i,
amt TYPE i,
END OF ty_makt.
data : it_makt TYPE STANDARD TABLE OF ty_makt,
wa_makt TYPE ty_makt.

wa_makt-matnr = '100'.
wa_makt-spras = 'e'.
wa_makt-maktx = 'soap'.
wa_makt-qty = 1.
wa_makt-amt = 10.
*append wa_makt to it_makt.
COLLECT wa_makt into it_makt.
wa_makt-matnr = '200'.
wa_makt-spras = 'e'.
wa_makt-maktx = 'paste'.
wa_makt-qty = 1.
wa_makt-amt = 20.
*append wa_makt to it_makt.
COLLECT wa_makt into it_makt.
wa_makt-matnr = '300'.
wa_makt-spras = 'e'.
wa_makt-maktx = 'brush'.
wa_makt-qty = 1.
wa_makt-amt = 15.
*append wa_makt to it_makt.
COLLECT wa_makt into it_makt.
wa_makt-matnr = '100'.
wa_makt-spras = 'e'.
wa_makt-maktx = 'soap'.
wa_makt-qty = 1.
wa_makt-amt = 10.
*append wa_makt to it_makt.
COLLECT wa_makt into it_makt.
wa_makt-matnr = '200'.

wa_makt-amt = 20. wa_makt-maktx = 'paste'. at FIRST . write : / ' At first triggered '. maktx type maktx. data : it_makt TYPE STANDARD TABLE OF ty_makt. wa_makt-qty = 1. wa_makt TYPE ty_makt. wa_makt-maktx = 'soap'. END OF ty_makt. wa_makt-matnr = '100'. *append wa_makt to it_makt. *COLLECT wa_makt into it_makt. wa_makt-qty = 1. wa_makt-maktx = 'paste'. ENDAT. qty TYPE i. write : / ' At first triggered '. wa_makt-qty = 1. wa_makt-spras = 'e'. COLLECT wa_makt into it_makt. wa_makt-amt = 20. .sy-tabix. wa_makt-spras = 'd'. TYPES : BEGIN OF TY_MAkt.wa_makt-spras = 'e'. wa_makt-amt = 10.sy-tabix. append wa_makt to it_makt. wa_makt-matnr = '200'. append wa_makt to it_makt. Endloop. Lecture 11 = “AT NEW” *&---------------------------------------------------------------------* *& Report ZDEMO_CONTROL_BREAK *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZDEMO_CONTROL_BREAK. matnr type matnr. amt TYPE i. at LAST. ENDAT. LOOP at it_makt INTO wa_makt. spras type spras.

*COLLECT wa_makt into it_makt. append wa_makt to it_makt. write : / ' At first triggered '.sy-tabix. append wa_makt to it_makt. wa_makt-amt = 20. *COLLECT wa_makt into it_makt. ENDAT. wa_makt-amt = 15. *COLLECT wa_makt into it_makt. endat. wa_makt-spras = 'd'. LOOP at it_makt INTO wa_makt. wa_makt-spras = 'e'. wa_makt-qty = 1.sy-tabix. wa_makt-matnr = '100'. write : / ' At new triggered '. . wa_makt-qty = 1. wa_makt-amt = 20. wa_makt-matnr = '300'. wa_makt-maktx = 'paste'. wa_makt-spras = 'd'. append wa_makt to it_makt. append wa_makt to it_makt. *COLLECT wa_makt into it_makt. wa_makt-qty = 1. wa_makt-spras = 'e'. wa_makt-matnr = '200'. wa_makt-matnr = '100'. wa_makt-amt = 10. *COLLECT wa_makt into it_makt. at FIRST . append wa_makt to it_makt. write : / ' At first triggered '. wa_makt-maktx = 'brush'. wa_makt-maktx = 'paste'. ENDLOOP.sy-tabix. ENDAT. at LAST. wa_makt-qty = 1. wa_makt-spras = 'f'. wa_makt-qty = 1. *COLLECT wa_makt into it_makt. at NEW spras. wa_makt-maktx = 'paste'. wa_makt-maktx = 'soap'. wa_makt-amt = 20. wa_makt-matnr = '300'.

maktx type maktx. wa_makt-amt = 20. wa_makt-maktx = 'paste'. wa_makt-maktx = 'brush'. append wa_makt to it_makt. wa_makt-spras = 'd'.Lecture 11 = “AT END OF ” *&---------------------------------------------------------------------* *& Report ZDEMO_CONTROL_BREAK *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZDEMO_CONTROL_BREAK. *COLLECT wa_makt into it_makt. wa_makt TYPE ty_makt. wa_makt-matnr = '100'. wa_makt-matnr = '200'. wa_makt-qty = 1. wa_makt-amt = 20. *COLLECT wa_makt into it_makt. wa_makt-qty = 1. *COLLECT wa_makt into it_makt. amt TYPE i. append wa_makt to it_makt. data : it_makt TYPE STANDARD TABLE OF ty_makt. wa_makt-spras = 'd'. matnr type matnr. wa_makt-amt = 15. append wa_makt to it_makt. END OF ty_makt. wa_makt-spras = 'e'. wa_makt-amt = 10. append wa_makt to it_makt. spras type spras. wa_makt-matnr = '100'. wa_makt-matnr = '200'. . TYPES : BEGIN OF TY_MAkt. wa_makt-maktx = 'paste'. wa_makt-maktx = 'soap'. wa_makt-spras = 'd'. qty TYPE i. wa_makt-qty = 1. wa_makt-qty = 1.

LOOP at it_makt INTO wa_makt. ENDAT. *COLLECT wa_makt into it_makt.*COLLECT wa_makt into it_makt. triggered '. wa_makt-spras = 'f'. *COLLECT wa_makt into it_makt. append wa_makt to it_makt. ENDLOOP. write : / ' At first triggered '.sy-tabix. at LAST. wa_makt-matnr = '100'. wa_makt-amt = 10. write : / ' At end of endat. wa_makt-matnr = '300'. . wa_makt-spras = 'e'. wa_makt-matnr = '300'.sy-tabix. wa_makt-spras = 'e'. wa_makt-maktx = 'paste'. wa_makt-qty = 1. at FIRST . wa_makt-qty = 1. wa_makt-qty = 1. triggered '. append wa_makt to it_makt. at NEW spras. write : / ' At last triggered '. ENDAT.sy-tabix.sy-tabix. wa_makt-maktx = 'soap'. write : / ' At new endat. wa_makt-amt = 20. wa_makt-amt = 20. at END OF spras. append wa_makt to it_makt. wa_makt-maktx = 'paste'. *COLLECT wa_makt into it_makt.

Sign up to vote on this title
UsefulNot useful