‎2007 Apr 17 12:03 PM
Under what category does Exit , Break , Continue statements come ?
Loop control statements ? Contol break statements like that
Kumar
‎2007 Apr 17 12:06 PM
These are control Break statements why because these statements will break the control of execution of statements.
Warm Regards,
Vijay
‎2007 Apr 17 12:07 PM
‎2007 Apr 17 12:07 PM
So AT FIRST ...END AT ....Those are also same ?
Can you give use of those EXIT , BREAK , CONTINUE statements ?
‎2007 Apr 17 12:11 PM
<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
<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.
‎2007 Apr 17 12:12 PM
AT FIRST AND AT LAST WIL BREAK THE LOOP FOR TEMPORARYLY N COME BACK AND CONTINUE WITH THE LOOP BUT EXIT N BREAK WILL COME OUT OF LOOP FOREVER
‎2007 Apr 17 12:14 PM
<b>EXIT</b>
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.<b>CONTINUE</b>
DO 100 TIMES.
IF SY-INDEX >= 10 AND SY-INDEX <= 20.
CONTINUE.
ENDIF.
...
ENDDO.
‎2007 Apr 17 12:24 PM
Hi,
STOP :This statement terminates a processing block in an excutable
program.
The statement is only intended for use in the INITIALIZATION,
AT SELECTION-SCREEN, START-OF-SELECTION, and GET events. It
terminates the current processing block in an executable
program and triggers the END-OF-SELECTION event. In all other
processing blocks, or when you do not want to trigger the
END-OF-SELECTION event, you must use EXIT.
EXIT.
- 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.
CHECK logexp.
CHECK evaluates the subsequent logical expression. If it is
true, the processing continues with the next statement.
In loop structures like
DO ... ENDDO
WHILE ... ENDWHILE
LOOP ... ENDLOOP
SELECT ... ENDSELECT
CHECK with a negative outcome terminates the current loop pass
and goes back to the beginning of the loop to start the next
pass, if there is one.
In structures like
FORM ... ENDFORM
FUNCTION ... ENDFUNCTION
MODULE ... ENDMODULE
AT events
GET events
CHECK with a negative outcome terminates the routine or
modularization unit.
If CHECK is neither in a loop nor a routine nor a
modularization unit, a negative logical expression terminates
the current event. In contrast, the statement REJECT terminates
the current event, even from loops or subroutines.
CONTINUE.
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 nex
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.
Hope this helps.