Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Internal Tables →  Expressions and Functions for Internal Tables →  table_exp - Table Expressions 

table_exp - Writing Positions

Table expressions and their chainings can be specified as writable expressions in result positions. The result of a table expression in these positions is always a temporary field symbol.

  • If a single table expression is specified, or a chaining whose last position is a table expression, the entire row that was found is modified in the writing position.
  • If a chaining is specified whose last position is a structure component after a structure component selector, this component is modified in the writing position.

In the case of writes performed on the temporary field symbol, the same rules apply as to a field symbol assigned a table row using READ TABLE ASSIGNING. More specifically, the read-only character of key fields must be respected. Table expressions that return a row of a sorted table or hashed table to writing positions (like the left side of an assignment) or as actual parameters for output parameters always raise an exception.

Other versions: 7.31 | 7.40 | 7.54


Note

The constructor operators VALUE and REF used to control the result of the table expression cannot be used in writing positions.


Example

An internal table is prefilled with initial rows, which are overwritten with a value in the DO loop.

DATA itab TYPE TABLE OF i WITH EMPTY KEY. 

itab = VALUE #( FOR i = 1 UNTIL i > 5 ( ) ). 

DO lines( itab ) TIMES. 
  itab[ sy-index ] = sy-index ** 2. 
ENDDO. 

Executable Example

Table Expressions, Writer Position

Continue

Table Expressions, Writer Positions