‎2007 Jun 19 2:55 PM
Give examples for Statements -
CONTINUE EXIT Where and how they can be used in programs give examples
‎2007 Jun 19 2:58 PM
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
‎2007 Jun 19 3:00 PM
<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.
‎2007 Jun 19 3:02 PM
CONTINUE: Will terminate the current loop process and continue with next.
EXIT: Will terminate the entire loop.