ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → 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
Generation and addressing of data objects
We differentiate between:
- 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 generated 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 generated 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 generated, and are subject to garbage collection.
- Literals, which are defined in the source text of a program and are fully determined by their value.
In addition to data objects declared in programs, there is a set of built-in data objects, which can always be accessed in ABAP programs. In addition, some statements implicitly generate data objects, 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 stand-alone 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
When it comes to changing data object values, we differentiate between variable and 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
We differentiate between static data objects, for which all technical attributes need to be defined on declaration, and 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 treatment 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.
This translation does not reflect the current version of the documentation.