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

CONTINUE!!!!!!!!!!!!!

Former Member
0 Likes
440

Give examples for Statements -


CONTINUE EXIT Where and how they can be used in programs give examples

3 REPLIES 3
Read only

Former Member
0 Likes
420

Hi,

To terminate a single loop pass immediately and unconditionally, use the CONTINUE statement in the statement block of the loop.

After the statement, the system ignores any remaining statements in the current statement block, and starts the next loop pass.

TO Terminate the entire Loop use the EXIT command

Regards

Sudheer

Read only

Former Member
0 Likes
420

<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.

Example

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

DO 100 TIMES.

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

CONTINUE.

ENDIF.

...

ENDDO.

<b>

Exit</b>

In loop structures:

Leaves the loop processing (DO , WHILE , LOOP , SELECT )

In subroutines and other modularization units (but outside loop structures):

Leaves the subroutine or modularization unit (FORM , MODULE , FUNCTION , TOP-OF-PAGE , END-OF-PAGE )

Outside loop structures and modularization units (report processing):

Cancels the report processing and displays the list

Example

TABLES T100.

DATA SAP_COUNT TYPE I.

SELECT * FROM T100 WHERE SPRSL = SY-LANGU AND

ARBGB = 'DS'.

WRITE / T100-TEXT.

IF T100-TEXT CS 'SAP'.

ADD 1 TO SAP_COUNT.

IF SAP_COUNT = 3.

EXIT.

ENDIF.

ENDIF.

ENDSELECT.

Read only

alex_m
Active Contributor
0 Likes
420

CONTINUE: Will terminate the current loop process and continue with next.

EXIT: Will terminate the entire loop.