ABAP Program Exit action (CHECK, Exit, return, LEAVE ...)

Source: Internet
Author: User

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.

EXIT.

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.

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.

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;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: