F SAP ABAP Program using COLLECT Statement | CodeTheta

SAP ABAP Program using COLLECT Statement

November 14, 2019

Code :
REPORT ZVP_COLLECT_PROGRAM.

TYPESBEGIN OF PERSON,
  ID TYPE N,
  NAME TYPE CHAR10,
  SALARY TYPE I,
  END OF PERSON.

DATAIT TYPE TABLE OF PERSON,
      WA TYPE PERSON.

WA-ID '1'.
WA-NAME 'SANJAY'.
WA-SALARY '5000'.
COLLECT WA INTO IT.
CLEAR WA.

WA-ID '1'.
WA-NAME 'SANJAY'.
WA-SALARY '500'.
COLLECT WA INTO IT.
CLEAR WA.

WA-ID '3'.
WA-NAME 'NIKESH'.
WA-SALARY '3000'.
COLLECT WA INTO IT.
CLEAR WA.

WA-ID '4'.
WA-NAME 'HIMANGSHU'.
WA-SALARY '5200'.
COLLECT WA INTO IT.
CLEAR WA.

LOOP AT IT INTO WA.
WRITE/ WA-ID'|',
          WA-NAME'|',
          WA-SALARY.
ULINE.
ENDLOOP.


Output :

IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment