ABAP Keyword Documentation → ABAP - Reference → Declarations → Declaration Statements → Data Types and Data Objects → Types and Objects - Overview
Data Objects
Data objects are instances of data types and contain the concrete data that a program uses at runtime. This is done by specifying data objects in operand positions.
Other versions: 7.31 | 7.40 | 7.54
Creating and Addressing Data Objects
The following objects are distinguished:
- Named data objects,
which are statically agreed with a data-defining statement and are addressed using a name. The typical
data-defining statement is
DATA
. Named objects are created at the start of the lifetime of a context (program, class, object, procedure) by the ABAP runtime environment, and exist for as long as their context exists.
- Anonymous data
objects, which are created by the statement
CREATE DATA
and are addressed using data reference variables. Anonymous data objects exist in the internal session of the program in which they were created, and are subject to garbage collection.
- Literals, which are defined in the source code of a program and are fully defined by their value.
In addition to data objects declared in programs, there is a set of
predefined data objects, which can always be accessed
in ABAP programs. In addition, some statements create data objects implicitly, which are then available for special purposes. Examples include sum(
), cnt( )
in control level processing for
extracts and title
when
selection screens are created.
Data Types of Data Objects
Every data object has a certain data type, and every data object uses memory to store the data. The data type of a data object is defined either with reference to a standalone data type or, when the data object is created, as a bound data type.
The data type of a data object is always uniquely defined at the runtime of the program and cannot be changed. In the case of anonymous data objects, this data type determines the dynamic type of the related reference variables.
Variable and Constant Data Objects
With respect to changing data object values, variable data objects are distinguished from constant data objects. Variables can change their value at runtime. Constants always keep their initial value. Literals and text symbols are also constant. Input parameters in procedures are generally not changeable either, if this would cause the assigned actual parameter to be changed.
Static and Dynamic Data Objects
Static data objects, for which all technical attributes need to be defined on declaration, are distinguished from dynamic data objects, whose memory requirement or size is not defined until runtime. Strings and internal tables are dynamic data objects.
After declaration, the length of a string is equal to 0 and changes at runtime depending on the content assigned to it. After declaration, internal tables do not contain any rows. Any number of rows is possible, and the rows are defined dynamically at runtime when the internal table is filled.
Structures that contain dynamic components are also dynamic data objects.
Flat and Deep Data Objects
All static data objects except reference variables are flat. Their content corresponds to the actual work data. Dynamic data objects and reference variables are deep. They contain references to the actual content. The handling of references is implicit for dynamic data objects (strings and internal tables), and explicit for reference variables.
Structures that do not contain any deep components are flat structures. Structures that contain at least one deep component are deep structures.