SAP ABAP - Check Statement



CHECK statement terminates a loop pass based on a condition. If the condition in the CHECK statement is evaluated to false then all the remaining statements in the statement block after the CHECK statement are ignored, and the next loop pass starts. The condition in the CHECK statement can be any logical expression.

The syntax for check statement is −

CHECK.

Example

Report YH_SEP_15.  
DO 5 TIMES.  
CHECK SY-INDEX BETWEEN 3 AND 4.  
Write / SY-INDEX.  
ENDDO.

The above code produces the following output −

3
4
sap_abap_loop_control.htm
Advertisements