ABAP Keyword Documentation → ABAP - Reference
Creating Objects
This section describes the creation of data objects and objects in the ABAP Objects language. Creating
an object or data object is equivalent to the dynamic creation of an instance of a data type or a class.
While instances of classes can only be created as described in this section, instances of data types
(data objects) that are declared with the statement DATA
,
or related statements, such as CONSTANTS
, are created automatically as named data objects when their
context is loaded into the
internal session. Dynamic creation of data objects is only necessary if the data type is only recognized
for the first time during program execution, or if you want large amounts of memory to be consumed only for short periods of time.
Dynamically created objects can only be addressed using reference variables, and can be deleted from the internal session by the Garbage Collector if they are no longer referenced.
There are two statements for creating objects:
Data objects and objects are created by default in the internal session of the current program, and only programs of the same internal session can access them. You can also create shared objects in the shared memory.
Other versions: 7.31 | 7.40 | 7.54
Note
The use of the statement ASSIGN LOCAL COPY
to create objects is now obsolete.