ABAP MODIFY command to modify database tables and internal tables
Change an internal table using the MODIFY command
*&-----------------------------------------------------------* *& Report ZMODIFYITAB * *& * *&-----------------------------------------------------------* *& Example of Modifying an internal table value * *& * *&-----------------------------------------------------------* *&-Created By details----------------------------------------* *& * *& Author : www.sapdev.co.uk * *& SAP ABAP development * *&-----------------------------------------------------------* Report ZMODIFYITAB. type-pools: slis. "ALV Declarations *Data Declaration *---------------- TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, END OF t_ekko. DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. ************************************************************************ *Start-of-selection. START-OF-SELECTION. select ebeln ebelp statu aedat matnr menge meins netpr peinh up to 10 rows from ekpo into table it_ekko. ************************************************************************ *End-of-selection. END-OF-SELECTION. loop at it_ekko into wa_ekko. wa_ekko-netpr = '100'. MODIFY it_ekko INDEX sy-tabix FROM wa_ekko TRANSPORTING netpr. endloop.
Add/Change a row in internal table
READ it_ekko into wa_ekko with key ebeln = ld_ebeln. if sy-subrc eq 0. MODIFY it_ekko from wa_ekko index sy-tabix. else. APPEND wa_ekko to it_ekko. endif.
MODIFY a database table from a work area
|
||||||||