Ansicht
Dokumentation

ABAPASSIGN_DEREF - ASSIGN DEREF

ABAPASSIGN_DEREF - ASSIGN DEREF

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

ASSIGN for Dereferencing

Variant 5

ASSIGN dref->* TO <fs>.

Additions

1. ... CASTING ... or
2. ... TYPE type
3. ... DECIMALS dec
4. ... RANGE r

Effect

The field to which the data reference dref is pointing is assigned to the field symbol <fs>. At runtime, the field symbol <fs> points to the same contents as the data reference dref. If the field symbol <fs> is not typed (FIELD-SYMBOLS), it adopts the type and attributes of the field to which dref is pointing. otherwise, the system checks whether the type of the field is compatible with the type of the field symbol <fs> when you make the assignment.

Note

If the data reference variable is fully typed - that is, if it does not have a generic type - the expression dref->* can also be used in other ABAP statements in any operand position.

Return Value

SY-SUBRC = 0:
Assignment successful
SY-SUBRC = 4:
Assignment not successful. The data reference was invalid.

Example

DATA: dref TYPE REF TO DATA.
TYPES: booking TYPE sbook.
FIELD-SYMBOLS: <fs> TYPE ANY.

CREATE DATA dref TYPE booking.
ASSIGN dref->* TO <fs>.

In this example, CREATE DATA is used to create an anonymous data object to which the reference dref points. Its type is that of the work area of the database table SBOOK. The data object is then assigned to the field symbol <fs> using the dereferencing operator ->*You can now work with the field symbol in the normal way.

Exceptions


For more information on the exceptions that can be raised by the ASSIGN statement, see ASSIGN Exceptions.

Related

CREATE DATA, GET REFERENCE, FIELD-SYMBOLS, UNASSIGN

Additional help

Assigning Data Objects to Field Symbols






CPI1466 during Backup   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 3307 Date: 20240426 Time: 193326     sap01-206 ( 49 ms )