F Append records from one to another internal table using APPEND LINES OF | CodeTheta

Append records from one to another internal table using APPEND LINES OF



Code :
REPORT ZVP_2_INTERNAL_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.

APPEND LINES OF IT1 TO IT2.
LOOP AT IT2 INTO WA2.
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