SAP® Documentation

Single view

ABAPASSIGN_DEREF - ASSIGN DEREF

BAL Application Log Documentation   PERFORM Short Reference  
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






CL_GUI_FRONTEND_SERVICES - Frontend Services   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 3622 Date: 20191210 Time: 225741     sap01-206 ( 18 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.