Wednesday 27 September 2017

ABAP: DO-ENDDO loop

'DO-ENDDO' is also called as unconditional loop, it is used to execute block of statements given number of times.

Syntax
DO N times.
         * Execute this block
ENDDO.

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

DATA n TYPE I VALUE 10.
DATA counter TYPE I VALUE 0.

DO n TIMES.
  Write: / 'Value of counter : ', counter.
  counter = counter + 1.
ENDDO.



Previous                                                 Next                                                 Home

No comments:

Post a Comment