Friday 19 January 2024

SAP program to move records from one internal table to another

REPORT ZSM_INTERNAL2.

TYPES: BEGIN OF str,
         id     TYPE int4,
         name   TYPE char10,
         location TYPE char10,
       END OF str.

DATA: it_one TYPE STANDARD TABLE OF str,
      wa TYPE str.

DATA: it_two TYPE STANDARD TABLE OF str.

wa-id = '1'.
wa-name = 'AAA'.
wa-location = 'Kolkata'.
APPEND wa TO it_one.

wa-id = '2'.
wa-name = 'BBB'.
wa-location = 'Chennai'.
APPEND wa TO it_one.

wa-id = '3'.
wa-name = 'CCC'.
wa-location = 'Hyderabad'.
APPEND wa TO it_one.

wa-id = '4'.
wa-name = 'DDD'.
wa-location = 'Lucknow'.
APPEND wa TO it_one.

wa-id = '5'.
wa-name = 'EEE'.
wa-location = 'Pune'.
APPEND wa TO it_one.

wa-id = '6'.
wa-name = 'FFF'.
wa-location = 'Bangalore'.
APPEND wa TO it_one.

wa-id = '7'.
wa-name = 'GGG'.
wa-location = 'Punjab'.
APPEND wa TO it_one.

wa-id = '8'.
wa-name = 'HHH'.
wa-location = 'Haryana'.
APPEND wa TO it_one.

MOVE it_one TO it_two.

LOOP AT it_two into wa.
WRITE:/ wa-id, wa-name, wa-location.
ENDLOOP.

No comments:

Post a Comment