ABAP Keyword Documentation → ABAP - Reference → Creating Objects and Values → CREATE DATA
CREATE DATA - REF TO
Other versions: 7.31 | 7.40 | 7.54
Syntax
CREATE DATA dref [area_handle]
TYPE REF TO {type|(name)}.
Effect
The addition TYPE REF TO is used by the statement CREATE
DATA to create a reference variable. The static type of the reference variable can be specified either directly as type or dynamically in name.
When type is specified, the same rules apply as to the definition of reference
types using the statement TYPES.
For data reference variables, either the generic type data or a fully specified data type can be specified. For object reference variables, either a class or an interface can be specified.
For name, a character-like field can be specified that has to contain the
name of a class, an interface, or a data type when the statement is executed. The name of the reference type in name can also be specified as an
absolute type name.
Note
Object types in name can also be specified dynamically in lowercase letters.
Example