Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

about continue and exit

Former Member
0 Likes
1,426

loop at itab.

IF <cond>.

Continue.

Endif.

Endloop.

If continue triggers what will happen, it comes out of loop and endloop for further loop pass or just comes out of IF and Endif.

hi,

continue statement is used to move to the starting of the loop i.e from the point it comes across continue statement it will go back to the loop statement.

and exit will get you out of the loop.

in your example

after the IF condition if it comes across <b>continue</b> it will move to the statement

<b>loop at itab</b>.

3 REPLIES 3
Read only

Former Member
0 Likes
1,192

Continue will continue with the next iteration of the loop skipping any logic which may be after the if statement.

Read only

Former Member
0 Likes
1,192

hi,

continue statement is used to move to the starting of the loop i.e from the point it comes across continue statement it will go back to the loop statement.

and exit will get you out of the loop.

in your example

after the IF condition if it comes across <b>continue</b> it will move to the statement

<b>loop at itab</b>.

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
1,192

Hi,

<b>EXIT</b>

- Within a loop structure:

Terminates looop processing (DO, WHILE, LOOP, SELECT).

- Within subroutines and other modularization units (but not

in a loop structure):

Leaves the subroutine or modularization unit (FORM, MODULE,

FUNCTION, TOP-OF-PAGE, END-OF-PAGE).

- Outside loop structures and modularization units (report

processing):

Terminates report processing and triggers list display.

DATA: SAP_COUNT TYPE I,

WA_T100 TYPE T100.

SELECT * FROM T100 INTO WA_T100 WHERE SPRSL = SY-LANGU AND

ARBGB = 'DS'.

WRITE / WA_T100-TEXT.

IF WA_T100-TEXT CS 'SAP'.

ADD 1 TO SAP_COUNT.

IF SAP_COUNT = 3.

EXIT.

ENDIF.

ENDIF.

ENDSELECT.

If you have a set of nested loops, EXIT only terminates the

current loop, and processing continues after the corresponding

END... statement in the next-highest loop.

<b>CONTINUE</b>

Within loop structures like

- DO ... ENDDO

- WHILE ... ENDWHILE

- LOOP ... ENDLOOP

- SELECT ... ENDSELECT

CONTINUE terminates the current loop pass, returns the

processing to the beginning of the loop and starts the next

loop pass, if there is one.

DO loop: Omit an area (10 ... 20)

DO 100 TIMES.

IF SY-INDEX >= 10 AND SY-INDEX <= 20.

CONTINUE.

ENDIF.

...

ENDDO.

Regards.

Marcelo Ramos