Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Structures →  Boxed Components 

Static Boxes

Static boxes are boxed components whose components are known statically and which are subject to initial value sharing. Declarations of static boxes generally require less memory for structures that occur multiple times but are rarely used.

The following can currently be declared as static boxes:

  • Substructures of structured data with the addition BOXED of the statement TYPES
  • Structured attributes of classes or interfaces with the addition BOXED of the statement [CLASS-]DATA.

A static box can have one of two states:

  • Initial value sharing

    As long as none of the actions named in the following point were executed, initial value sharing applies to a static box. The internal reference points to a type-dependent initial value for the structure, which is saved exactly once in each AS Instance in the PXA. The memory requirement in the internal session is determined only by the internal reference and its administration.
  • Revoked initial value sharing

    The following actions revoke initial value sharing for a static box:
  • Writes to the static box or one of its components
  • Addressing the static box or one of its components using a data reference
  • Using a static box or one of its components as an actual parameter for procedure calls
The internal reference then references an instance of the structure in the current internal session. The memory requirement is the same as for a regular structure plus the administration costs for the internal reference.

In initial value sharing, the memory required for the internal session of a static box is not known initially when the program is executed. However, unlike in real dynamic data objects, the length of a static box is always known statically. In static boxes, the same functions are available as for a regular component of the same type. When a structure that contains a static box is accessed, however, it must not be forgotten that it is a deep component.

Other versions: 7.31 | 7.40 | 7.54


  • Static boxes can be used to optimize the memory requirement of structures that are used more than once. If, for example, the row structure of an internal table contains substructures, the memory requirement of the substructure accumulates without the use of static boxes for each row, even if the substructure is initial. If static boxes are used, initial substructures do not require multiple memories as long as only reads are performed.

  • In addition to the optimized memory requirements, static boxes generally have a positive impact on runtime performance, because assignments between components for which initial value sharing is active only require the internal reference (and no additional data) to be copied.

  • The statements CLEAR and FREE do not operate as write statements on a static box that has the initial value sharing state, and the state is persisted. On the other hand, once the initial value sharing state is revoked, these statements do not currently free up any memory and provide the local instance of the static box with type-dependent initial values instead.


Declares a substructure scarr as a static box.

  BEGIN OF struct, 
    comp      TYPE c LENGTH 10, 
    scarr TYPE scarr BOXED, 
  END OF struct.