Copyright 2024 - BV TallVision IT

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...
  • CHECK skips to the next in a DO, WHILE, LOOP or SELECT loop.
    So: a CHECK with a negative result will stop the processing of the current LOOPline and continues with the next one.
  • CHECK in a FORM, FUNCTION or MODULE (not within a loop) skips the routine. The program jumps to the first statement after the cal for the FORM, FUNCTION or MODULE.
  • CONTINUE is a simplified version of CHECK. CONTINUE always jumps to the next loop, as if there was written: CHECK 1 EQ 2. Applies to the loops: DO, WHILE, LOOP and SELECT.
  • EXIT exits a DO, WHILE, LOOP or SELECTloop. The next statement processed is the first one after the loop.
  • RETURN exits a processing block unconditionally (like CHECK 1 eq 2.)
  • STOP, stops all data selection. The first statement to be processed after a STOP is: END-OF-SELECTION.
  • LEAVE, is for screen flow purposes, thus LEAVE TO SCREEN 900 or LEAVE 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 by LEAVE SCREEN. LEAVE TO SCREEN 0 is allowed as well.
  • SUBMIT without AND RETURN
  • LEAVE TO TRANSACTION ...