Open all | Close all


Using the ABAP MODIFY command

MODIFY an Internal table value  

Changing values within an internal table using the MODIFY command is a very powerfull yet simple process to perform. The code below demonstrates how you can populate an internal table and then change the value of a specific field within that internal table.


*&---------------------------------------------------------------------*
*& 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.

 

 

Number of SAP Development Users currently online hit counters