Leave, exit, check, continue, return and reject... These statements sound alike, but differ considerably.
REJECT
is the least important; it stops the processing of the current database line and moves to the next one - where logical databases are used (e.g. in HR). Not often used in ABAPs...CHECK
skips to the next in aDO, WHILE, LOOP
orSELECT
loop.
So: aCHECK
with a negative result will stop the processing of the currentLOOP
line and continues with the next one.CHECK
in aFORM, FUNCTION
orMODULE
(not within a loop) skips the routine. The program jumps to the first statement after the cal for theFORM, FUNCTION
orMODULE
.CONTINUE
is a simplified version ofCHECK. CONTINUE
always jumps to the next loop, as if there was written:CHECK 1 EQ 2
. Applies to the loops:DO, WHILE, LOOP
andSELECT
.EXIT
exits aDO, WHILE, LOOP
orSELECT
loop. The next statement processed is the first one after the loop.RETURN
exits a processing block unconditionally (likeCHECK 1 eq 2.
)STOP
, stops all data selection. The first statement to be processed after aSTOP
is:END-OF-SELECTION
.LEAVE
, is for screen flow purposes, thusLEAVE TO SCREEN 900
orLEAVE PROGRAM
would define a program's screen flow.
And of course there are another ways of interrupting:
- calling an E-message (see
MESSAGE
) - performing
SET SCREEN 0
followed byLEAVE SCREEN
.LEAVE TO SCREEN 0
is allowed as well. SUBMIT
withoutAND RETURN
LEAVE TO TRANSACTION ...