SAP MDG x ABAP: LOOP backward using Internal Table

Suggu SandeepSuggu Sandeep
1 min read

Note: The below abap code will be helpful at the time of requirement.


SELECT ebeln FROM ekko INTO TABLE @DATA (lt_ebeln) UP TO 5 ROWS.

    WRITE: / 'NORMAL LOOPING'.

LOOP AT lt_ebeln INTO DATA (LS_ebeln).
    WRITE:/ LS_EBELN-EBELN COLOR 1.
ENDLOOP.

ULINE.
**************************************************************

    WRITE / 'REVERSE LOOPING'.

LOOP AT 1t_ebeln INTO LS_ebeln STEP -1.
    WRITE: LS_EBELN-EBELN COLOR 7.
ENDLOOP.

Output:



Credits: VIKRAM PATHAK


Thanks and regards,
Suggu Sandeep.
(SAP MDG Co
nsultant)

0
Subscribe to my newsletter

Read articles from Suggu Sandeep directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Suggu Sandeep
Suggu Sandeep

Connect: Let's Discuss https://topmate.io/suggu_sandeep