Entering content frameCreating Data Objects Dynamically Locate the document in its SAP Library structure

All of the data objects that you define in the declaration part of a program using statements such as DATA are created statically, and already exist when you start the program. To create a data object dynamically during a program, you need a data reference variable and the following statement:

CREATE DATA <dref> TYPE <type>|LIKE <obj>.

This statement creates a data object in the internal session of the current ABAP program. After the statement, the data reference in the data reference variable <dref> points to the object. The data object that you create does not have its own name. You can only address it using a data reference variable. To access the contents of the data object, you must dereference the data reference.

You must specify the data type of the object using the TYPE or LIKE addition. In the TYPE addition, you can specify the data type dynamically as the contents of a field (this is not possible with other uses of TYPE).

CREATE DATA <dref> TYPE (<name>).

Here, <name> is the name of a field that contains the name of the required data type.


Leaving content frame