Leave, exit, check, continue, return and reject... These statements sound alike, but differ considerably.
REJECTis 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...CHECKskips to the next in aDO, WHILE, LOOPorSELECTloop.
So: aCHECKwith a negative result will stop the processing of the currentLOOPline and continues with the next one.CHECKin aFORM, FUNCTIONorMODULE(not within a loop) skips the routine. The program jumps to the first statement after the cal for theFORM, FUNCTIONorMODULE.CONTINUEis a simplified version ofCHECK. CONTINUEalways jumps to the next loop, as if there was written:CHECK 1 EQ 2. Applies to the loops:DO, WHILE, LOOPandSELECT.EXITexits aDO, WHILE, LOOPorSELECTloop. The next statement processed is the first one after the loop.RETURNexits a processing block unconditionally (likeCHECK 1 eq 2.)STOP, stops all data selection. The first statement to be processed after aSTOPis:END-OF-SELECTION.LEAVE, is for screen flow purposes, thusLEAVE TO SCREEN 900orLEAVE PROGRAMwould define a program's screen flow.
And of course there are another ways of interrupting:
- calling an E-message (see
MESSAGE) - performing
SET SCREEN 0followed byLEAVE SCREEN.LEAVE TO SCREEN 0is allowed as well. SUBMITwithoutAND RETURNLEAVE TO TRANSACTION ...
