CHECK
If the check statement appears in a LOOP process block, the unfufilled condition check will stop processing rest codes and do next loop.
If the check statement appears in a EVENT block, the unfufilled condition check will stop current event process and jump to next evetn.
EXIT
If you use the EXIT statement within an event block but not in a loop, the system stops processing the block immediately.If the EXIT statement occurs in a loop using DO, WHILE, or LOOP, it is the loop that terminates, not the processing block.
STOP
If you use the STOP statement within an event block, the system stops processing the block immediately.Before and during selection screen processing, the next event in the prescribed sequence is always called. From the AT SELECTION-SCREEN event onwards, the system always jumps from a STOP statement directly to the END-OF-SELECTION statement. Once the corresponding event block has been processed, the system displays the list.
RETURN
If the return occurs in a subroutine, the system will jump out the subroutine processing. If the return occurs in event block processing, system will stop the program directly.
e.g.
START-OF-SELECTION.
PERFORM frm_test.
return.
WRITE / 'start of selection'.
END-OF-SELECTION.
WRITE / 'end of selection'.
*&---------------------------------------------------------------------*
*& Form frm_test
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM frm_test.
DO 5 TIMES.
IF sy-index = 2.
RETURN.
WRITE 'IF STATEMENT'.
ENDIF.
WRITE: 'DO', sy-index.
ENDDO.
WRITE / 'END'.
ENDFORM. "frm_test
本文详细介绍了 ABAP 编程语言中的关键控制语句,包括 CHECK、EXIT、STOP 和 RETURN 的用法及区别。CHECK 用于循环或事件块中条件判断,未满足条件时跳过后续代码执行;EXIT 用于立即退出当前事件块或循环;STOP 用于停止事件块处理,并直接跳转到 END-OF-SELECTION;RETURN 则用于退出子程序或停止整个程序运行。
1271

被折叠的 条评论
为什么被折叠?



