Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

LOOP sets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.

LOOP AT sets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.

* Entries: 1000 (ITAB1), 300 (ITAB2)


* Line width: 100
* Both tables sorted by unique key K ascending
DATA: I TYPE I.

I = 1.

LOOP AT ITAB1 INTO WA1.

do.

READ TABLE ITAB2 INTO WA2 INDEX I.


IF SY-SUBRC <> 0.
EXIT.
ENDIF.

IF WA2-K < WA1-K.


ADD 1 TO I.
ELSEIF WA2-K = WA1-K. “ { uptill WA2-K = WA1-K is satisfied do …endo. Loop *goes on and on. }.
" ...
ADD 1 TO I.
EXIT.
ELSE.
EXIT.
ENDIF.

enddo.

if sy-subrc <> 0. “ { Means if the “do..enddo.” loop is not executed atleast * once kindly come out of
Main loop at.. enddloop. }
exit.
endif.

ENDLOOP.

You might also like