ABAP Program Exit action (CHECK, Exit, return, LEAVE ...)
Here's a summary of several common exit actions:
CHECK. (SAP official recommendation is only used in the cycle)
1 Check follows an expression that, when the expression value is False (false), the check takes effect, exits the loop (loop), or the handler (processing block).
2 If a check appears in a loop, then the action occurs when the current loop operation is exited, and the program continues to perform the next loop operation, similar to the continue (continue in Java or C + +).
3 If a check appears outside the loop, then the action is exited by the currently executing block of the program (processing blocks), such as a form,method, or event.
1 exit if appears in the loop, the exit is the entire loop operation,. The program continues to execute at the end of the loop, which acts like a break in Java and C + +.
2 exit if it appears outside the loop, the exit is the currently executing program block, such as a form,method, or event, which acts like return. Processing
Return is used to exit the currently executing program block, such as a form,method, or event, regardless of whether it appears in the loop (loop), return exits the currently executing block, not just the exit loop. Processing
Although exit and return in ABAP can be used to exit the currently executing block of statements (processing blocks), the SAP Help file suggests that exit is used only in loops, in other cases to exit the current execution process and use return.
LEAVE program will exit the main programs directly, similar to exit in C + +.
In events, CHECK in Start-of-selection, get, end-of-selection events, only interrupt the execution of subsequent code within this event, without affecting the processing of other subsequent modules
Start-check SS <> write/end-write/
Result: End of selection
Exit return in event, in Start-of-selection, get, end-of-selection events, will directly trigger the list output, will not perform end-of-selection event, and if there is no list output, the system will be returned directly Back to select the screen;