ABAP Keyword Documentation → ABAP - Release-Specific Changes → Changes in Release 7.0 and its EhPs → Changes in Release 7.0, EhP2
Boxed Components in Release 7.0, EhP2
Structures or classes often have further structures as components which are not used every time a program is executed. This can lead to unnecessary memory usage, especially if these structures are instantiated multiple times. Examples are structures with substructures as a row type from internal tables or structures in classes that are frequently instantiated. To avoid unnecessary memory usage without this having to be programmed by ABAP developers, static boxes were introduced as a preliminary form of boxed components in Release 7.0 (EhP2). Like strings and internal tables, these are based on an implicit referencing and support initial value sharing.
1. Structured types with static boxes
2. Attributes of classes as static boxes
3. Enhancements to RTTS for static boxes
Other versions: 7.31 | 7.40 | 7.54
Modification 1
Structured types with static boxes
Within a structure definition using TYPES
BEGIN OF, the BOXED
addition of TYPES
can be used to create a substructure as a static box.
Modification 2
Attributes of classes as static boxes
Within a class declaration, the BOXED
addition of DATA
can be used to create a structured attribute as a static box.
Modification 3
Enhancements to RTTS for static boxes
The class CL_ABAP_TYPEDESCR contains the new constant TYPEKIND_BREF for
static boxes. The value of these constants is specified as the type of a static box in the component
table COMPONENTS of the class CL_ABAP_STRUCTDESCR. The return code of the
method GET_COMPONENTS of the class CL_ABAP_STRUCTDESCR contains boxed components
and reference variables as type description objects of the class CL_ABAP_REFDESCR.
The method GET_REFERENCED_TYPE of this class gets a type description object for the substructure. A
type description object of the class CL_ABAP_REFDESCR, which describes a boxed component, cannot be
used in the statements CREATE DATA
or ASSIGN CASTING
.