Friday 26 January 2024

SAP program to modify a record in internal table.

REPORT zsm_edit.

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

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

wa-id = '1'.
wa-name = 'Suvadeep'.
wa-location = 'Kolkata'.
APPEND wa TO it.

wa-id = '2'.
wa-name = 'Nitai'.
wa-location = 'Bangalore'.
APPEND wa TO it.

wa-id = '3'.
wa-name = 'Chirashree'.
wa-location = 'Pune'.
APPEND wa TO it.

wa-id = '4'.
wa-name = 'Soumyodeep'.
wa-location = 'Hyderabad'.
APPEND wa TO it.

wa-location = 'Kolkata'.
MODIFY it FROM wa TRANSPORTING location WHERE id = '2'.

*clear it.

*FREE it.

loop at it into wa.

  write:/ wa-id, wa-name, wa-location.

  ENDLOOP.

No comments:

Post a Comment