ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Assignments → Assigning References → Setting Field Symbols
UNASSIGN
Other versions: 7.31 | 7.40 | 7.54
Syntax
UNASSIGN <fs>.
Effect
This statement initializes the field symbol <fs>
. After the statement, the field symbol does not reference a memory area and the
predicate expression
<fs> IS ASSIGNED
is false.
Notes
-
The statement
CLEAR <fs>
does not initialize the field symbol and initializes the memory area that is assigned to the field symbol instead. -
Unlike the initialization of reference variables, the statement
UNASSIGN
does not affect Garbage Collector.
Example
A field symbol to which a memory space is assigned is initialized with UNASSIGN
.
FIELD-SYMBOLS <fs> TYPE d.
ASSIGN sy-datlo TO <fs>.
IF <fs> IS ASSIGNED.
cl_demo_output=>write( 'assigned' ).
ENDIF.
UNASSIGN <fs>.
IF <fs> IS NOT ASSIGNED.
cl_demo_output=>write( 'unassigned' ).
ENDIF.
cl_demo_output=>display( ).