SAP NEWS-610-REFERENZEN

Get Example source ABAP code based on a different SAP table
  



Data References in Release 6.10

1 Typing using TYPE DATA
2 Specifying types for CREATE
3 Uppercase and lowercase in dynamically specified types
4 Defining typed data references
5 Casting data references
6 Additional type information for ASSIGN dref->*
7 Any typing for CREATE DATA
8 Dereferencing in any operand positions

ABAP_MODIFICATION_1 Typing Using TYPE DATA


TYPE DATA was previously handled like 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 occurs. A non-generic type can now be specified after REF TO.

ABAP_MODIFICATION_2 Specifying Types for CREATE


A type no longer needs to be specified for the statement CREATE DATA ... if the reference is fully typed. In this case, the new data object is given the type of the reference.

ABAP_MODIFICATION_3 Uppercase and Lowercase in Dynamically Specified Types


In the statement CREATE DATA ..., previously only uppercase letters could be used for the field content of dynamically specified types. In Release 6.10, lowercase letters can also be used. Initially the system searches using the specified field content; if this search fails, the system searches again using uppercase letters. If this search also fails, a runtime error occurs.

ABAP_MODIFICATION_4 Defining Typed Data References


In the case of the statements TYPES and DATA, a fixed type can now be specified for the addition REF TO.

ABAP_MODIFICATION_5 Casting Data References


The introduction of typed data references enables down casts for in assignments between data reference variables. It must be expressed using a special assignment operator, ?=.



Example ABAP Coding
DATA:
d1 TYPE REF TO data, 'Generic
d2 TYPE REF TO i. 'Typed
d1 = d2.
d2 ?= d1.

ABAP_MODIFICATION_6 Additional Type Information for ASSIGN dref->*


If a data reference has fixed typing, it passes on its additional attributes if it is assigned to an untyped data reference. DATA:
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> inherit the attributes of the dictionary data element DTEL_2.

ABAP_MODIFICATION_7 Any Typing for CREATE DATA


New types, such as data references and internal tables, can be constructed when data objects are created using the statement CREATE DATA. Previously, only references to existing types were possible.

ABAP_MODIFICATION_8 Dereferencing in Any Operand Positions


If a data reference variable is fully typed, it can be dereferenced in any operand position, using the dereferencing operator ->*.
DATA dref TYPE REF TO i.
...
dref->* = dref->* + 1.