Thursday 28 September 2017

ABAP: CHECK statement

CHECK statement is used to skip the loop statements when the given condition is false. If the condition is false, the control directly goes to the end statement of the current loop pass ignoring the remaining statements in the current loop pass, starts the next loop pass.

Syntax
CHECK condition.

Z_HELLO_WORLD

*&---------------------------------------------------------------------*
*& Report Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_HELLO_WORLD.

DATA counter TYPE I VALUE -1.

WHILE counter < 10.
  counter = counter + 1.

  CHECK counter > 5.

  Write: / 'Value of counter : ', counter.
ENDWHILE.

Write / 'End of the loop'.






Previous                                                 Next                                                 Home

No comments:

Post a Comment