SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Data Types and Data Objects → Types and Objects - Overview → Details of Special Data Types or Data Objects →Structures
Structures are data objects (comprised of components of any data type) that are saved one after the other in the memory. The data type of a structure is a structured type or a structure defined in the ABAP Dictionary, including database tables and views.
In a program, a structured type or structure is created using the additions BEGIN OF ... END OF additions of the statements TYPES, DATA etc. They can also be created dynamically using RTTC methods.
Types of Structures
Structures are named as follows (depending on the type of the component):
A structure that contains static or dynamic components is (formally) a static or dynamic data object, respectively.
The following figure illustrates a deep structure.
Note
The term "nested structure" must not be confused with the term "deep structure". A nested structure is flat if it only contains flat components and subcomponents. A nested structure is deep when it has at least one deep component or subcomponent.
Boxed Components
The substructures of nested structures and structured components of classes or interfaces can be declared as boxed components.
Using Structures
Structures are addressed either fully or by component, at appropriate operand positions. The structure component selector (-) is used for the latter case. Special conversion rules apply to assignments that involve structures.
Flat character-like structures (any flat structures in non-Unicode programs) can be used as character-like data objects; they are also included in the generic ABAP type clike. They can be placed in all operand positions where elementary character-like data objects are possible. The ABAP runtime environment then interprets the structure as an elementary field of the type c in the length of the structure.
Using Deep Structures
The data content of deep structures is not saved completely within the memory bounds of the structure and the deep components are just references to the actual data instead. This means that some general restrictions apply when using deep structures (unlike flat structures):
Note
These restrictions are particularly important if single components in existing flat character-like structures are converted to strings, which makes the entire structure deep.
Using Deep ABAP Dictionary Structures
The same restrictions apply to deep structures defined in ABAP Dictionary as to deep structures defined in ABAP programs. Further restrictions apply only when you use the following language elements forbidden in classes (in which you can declare only flat ABAP Dictionary structures):
Programming Guideline
Do not include components from structures
Note
When a screen field refers to a component of a structure in ABAP Dictionary, it is important that the structure is declared with TABLES to enable a data transport between the screen and the ABAP program; only flat structures are suitable here.
Maximum Size of Structures
The memory used directly by a structure cannot exceed a certain size, including any alignment gaps. This size is defined so that a given structure in a non- Unicode system, in which each character uses one byte can use a maximum of 64 KB. In a Unicode system, the maximum amount of memory that can be used can be more. This depends on the number of characters and the character set used. A deep component only contributes the size of the reference (8 bytes) to the directly used memory.