ABAP Keyword Documentation → ABAP − Release-Specific Changes → Changes in Release 7.0, EhP2
Boxed Components for Release 7.0, EhP2
A common use case is structures or classes that have further structures as components that are not used for every program execution. This can lead to unnecessary memory consumption, 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. In order to avoid unnecessary memory consumption without this having to be programmed by ABAP developers, static boxes, initially called boxed components, were introduced 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
- Enhancement of 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 to 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 to DATA
can be used to create a structured attribute as a static box.
The class CL_ABAP_TYPEDESCR contains a new constant TYPEKIND_BREF for static
boxes. The value of these constants is specified as a type of static box in the component table COMPONENTS
of class CL_ABAP_STRUCTDESCR. In the return code of the method GET_COMPONENTS
of class CL_ABAP_STRUCTDESCR, boxed components are listed like reference
variables as type objects of class CL_ABAP_REFDESCR. The method GET_REFERENCED_TYPE
of this class returns a type object for the substructure. A type object of class CL_ABAP_REFDESCR that
describes a boxed component cannot be used in the CREATE
DATA or ASSIGN CASTING
statements.