ABAP Keyword Documentation → ABAP − Release-Specific Changes → Changes in Release 6.10
Data References in Release 6.10
1. Assigning types using TYPE DATA
2. Type specification for CREATE
3. Upper and lower case spelling in dynamic type specifications
4. Defining typed data references
5. Casting data references
6. Additional type information for ASSIGN dref->*
7. New types for the CREATE DATA statement
8. Dereferencing at any operand position
Other versions: 7.31 | 7.40 | 7.54
Modification 1
Assigning types using TYPE DATA
Specifications of the form TYPE DATA were previously treated as TYPE REF TO DATA and were therefore fully typed. Now TYPE DATA can only be used for formal parameters and field symbols; otherwise a syntax error will occur. After REF TO you can now also specify a generic type.
Modification 2
Type specification for CREATE
A type specification is no longer necessary for the CREATE DATA ... statement if the reference is fully typed. In this case the new data object is assigned the type of the reference.
Modification 3
Upper and lower case spelling in dynamic type specifications
In the CREATE DATA ... statement you could previously only use capital letters for the field contents of dynamic type specifications. In Release 6.10 you can now also use lower case letters. Initially the system searches with the specified field content; if this search fails, the system will carry out a new search using capital letters. If this search also fails then a runtime error occurs.
Modification 4
Defining typed data references
In the case of the statements TYPES
and DATA
you can now specify a precise type for the addition REF TO.
Modification 5
Casting data references
The introduction of typed data references enables the Down Cast for the assignment between data reference variables. It must be expressed using the appropriate assignment operator ?=
.
Example
DATA:
D1 type ref to data, "Generic
D2 type ref to I. "Typed
D1 = D2.
D2 ?= D1.
Modification 6
Additional type information for ASSIGN dref->*
If a data reference is of a fixed type, then it passes on its additional attributes, if it is assigned to an untyped data reference.
DATAOBJ type DTEL_1,
DATAREF_1 type ref to DTEL_2,
DATAREF_2 type ref to data.
field-symbols <FS> type any.
get reference of DATAOBJ to DATAREF_1.
dataref_2 = dataref_1.
ASSIGN dataref_2->* TO <fs>.
In this case, dataref_1->
, dataref_2->
and <F> adopt the attributes of the Dictionary data element DTEL_2.
Modification 7
New types in the CREATE DATA statement
You can now construct new types, such as data references and internal tables, when you create data objects
using the CREATE DATA
statement. Previously you could only refer to existing types.
Modification 8
Dereferencing at any operand position
If a data reference variable is fully typed, you can dereference it at any operand position, using the dereferencing operator ->*
DATA dref TYPE REF TO i.
...
dref->* = dref->* + 1.