ASSIGN - mem_area
Short Reference
ABAP Syntax ...
static_dobj
| dynamic_dobj
| dynamic_access
| writable_exp ... .
ABAP_ALTERNATIVES:
Static Specification
1 ... static_dobj
Dynamic Specifications
2. ... dynamic_dobj
3. ... dynamic_access
Specifying an Expression
4. ... writable_exp
What does it do? mem_area is used to specify the memory area that
is assigned to the field symbol.
The first variant static_dobj
is 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_dobj are used
for general dynamic access to data objects; the variants
dynamic_access are
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-subrc is not set for the static variant.
In dynamic variants and when a
table expression is specified, the statement ASSIGN sets the
return code sy-subrc .
Latest 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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved