Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Internal Tables →  Processing Statements for Internal Tables →  MODIFY itab →  MODIFY itab - itab_line 

MODIFY itab - result

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


... { ASSIGNING <fs> [CASTING] } 
  | { REFERENCE INTO dref }.

Effect

These additions are possible only when modifying single rows. If modified successfully, the addition ASSIGNING is used to assign the row to a field symbol and the addition REFERENCE INTO is used to set a reference to the modified row in a reference variable.

The syntax and meaning are the same as when specifying the output behavior in the statement READ TABLE and the same restrictions apply regarding the modification of key fields for primary and secondary table keys. In particular, inline declarations using the declaration operators DATA and FIELD-SYMBOL are possible.


Example

Changes smoking seats to non-smoking seats in an internal table of flight bookings. After the loop, each row in the reference table reftab references a row in itab in which a change took place.

DATA itab TYPE HASHED TABLE OF sbook 
          WITH UNIQUE KEY carrid connid fldate bookid. 

SELECT * 
       FROM sbook 
       INTO TABLE @itab. 

DATA reftab TYPE TABLE OF REF TO sbook WITH EMPTY KEY. 
LOOP AT itab INTO DATA(line) WHERE smoker = 'X'. 
  CLEAR line-smoker. 
  MODIFY TABLE itab FROM line TRANSPORTING smoker 
                   REFERENCE INTO DATA(dref). 
  APPEND dref TO reftab. 
ENDLOOP.