F Records from one to another internal table using LOOP | CodeTheta

Records from one to another internal table using LOOP

March 08, 2020

Code :
REPORT ZVP_2_INTER_TBL_REC_TRANS.

TYPES: BEGIN OF STR1,
  ID TYPE CHAR10,
  NAME TYPE CHAR10,
  COUNTRY TYPE CHAR10,
  END OF STR1.

  TYPES: BEGIN OF STR2,
  ID TYPE CHAR10,
  NAME TYPE CHAR10,
  COUNTRY TYPE CHAR10,
  END OF STR2.

DATA: IT1 TYPE STANDARD TABLE OF STR1,
      WA1 TYPE STR1,

      IT2 TYPE STANDARD TABLE OF STR2,
      WA2 TYPE STR2.

WA1-ID = '1'.
WA1-NAME = 'RAJESH'.
WA1-COUNTRY = 'KOLKATA'.
APPEND WA1 TO IT1.
CLEAR WA1.

WA1-ID = '2'.
WA1-NAME = 'BINAY'.
WA1-COUNTRY = 'GUJARAT'.
APPEND WA1 TO IT1.
CLEAR WA1.

LOOP AT IT1 INTO WA1.
  WA2-ID = WA1-ID.
  WA2-NAME = WA1-NAME.
  WA2-COUNTRY = WA1-COUNTRY.
  WRITE:/ WA2-ID, WA2-NAME, WA2-COUNTRY.
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