ABAPASSIGN_DEREF - ASSIGN DEREF
General Data in Customer Master CPI1466 during BackupThis documentation is copyright by SAP AG.
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.
- 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, CREATEDATA 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
General Material Data PERFORM Short Reference
This documentation is copyright by SAP AG.
Length: 3454 Date: 20120518 Time: 192049 triton ( 117 ms )






