ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Assignments → Assigning References → Setting Field Symbols → ASSIGN
ASSIGN - mem_area
Other versions: 7.31 | 7.40 | 7.54
Syntax
... static_dobj
| dynamic_dobj
| dynamic_access
| writable_exp ...
Alternatives
Static SpecificationDynamic SpecificationsSpecifying an Expression
Effect
mem_area is used to specify the memory area that is assigned to the field symbol.
-
The first variant
static_dobjis a static variant that is assigned a statically defined data object or part of one of these objects. -
The second and third variants are dynamic. The variants
dynamic_dobjare used for general dynamic access to data objects; the variantsdynamic_accessare used for dynamic access to the attributes of classes. -
The result of a writable expression is assigned in the fourth variant.
In an inline declaration of the field symbol with
FIELD-SYMBOL(<fs>), the typing of the field symbol is performed for the static variant
and for a specified expression with the data type mem_area. In the dynamic variants, the typing is performed with the generic type data.
The variants differ in the way that the system behaves after a successful assignment:
-
The return code
sy-subrcis not set for the static variant. -
In dynamic variants and when a table expression
is specified, the statement
ASSIGNsets the return codesy-subrc.
Notes
-
In an internal table with a header line, either the header line or the
table body can be assigned
to a field symbol. In the statement
ASSIGN, the name of an internal table with a header line addresses the header line. To address the table body,[]must be appended to the name in the usual way. A field symbol to which a table body is assigned behaves in the same way in operand positions as a table without a header line. - Field symbols to which data objects or parts of data objects are assigned in the heap are memory-preserving, like heap references.
-
In an inline declaration of the field symbol with
FIELD-SYMBOL(<fs>), the data type of the assigned memory area determines the typing of the field symbol.