ABAP Keyword Documentation → ABAP − Reference → Creating Objects and Values → CREATE DATA
CREATE DATA dref
Other versions: 7.31 | 7.40 | 7.54
Syntax
CREATE DATA dref [area_handle].
Effect
Creates an anonymous data object with an implicit type. If none of the additions TYPE
or LIKE
is specified, data reference variable dref
must be fully typed. The data object is then created with the static data type of the data reference variable.
Note
When the character #
is used in an operand position with the operand type of a data reference variable, the
instance operator
NEW
works like the statement CREATE DATA dref
.
Example
Creates an anonymous data object of the type SCARR from ABAP Dictionary. The type is implicitly determined using the static data type of the data reference variable.
DATA dref TYPE REF TO scarr.
CREATE DATA dref.
SELECT SINGLE *
FROM scarr
WHERE carrid = 'LH'
INTO @dref->*.
cl_demo_output=>display( |{ dref->carrid }, { dref->carrname }| ).
Executable Example
Creating Data Objects with Implicit Type