Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarative statemnts →  Data Types and Data Objects →  Types and Objects - Overview →  Details of Special Data Types or Data Objects →  Boxed Components 

Static Boxes

Static boxes are boxed components whose components are available statically and to which initial value sharing applies. If static boxes are declared for structures that are used more than once but not particularly often, this generally reduces memory requirements.

Static boxes can currently be declared for:

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

A boxed component can have two statuses:

  • Initial value sharing

    As long as none of the actions listed in the following point were executed, initial value sharing applies for a static box. The internal reference points to an appropriate initial value for the structure type, which is stored exactly once for each application server in the PXA. The memory requirement of 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:
  • Write access to the static box or one of its components
  • Assigning the static box or one of its components to a field symbol using ASSIGN
  • 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 normal structure plus the administration costs for the internal reference.

With initial value sharing, the memory required for the internal session of a static box is not initially known when the program is executed. However, unlike with real dynamic data objects, the length of a static box is always available statically. With static boxes, the same functions are available as those available for normal components of the same type. However, when you access a structure that contains a static box, you need to keep in mind that this is a deep component.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • 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. When static boxes are used, initial substructures do not require multiple memory stores as long as they permit read-access only.

  • 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 CLEAR and FREE statements do not work as write statements on a static box that has the initial value sharing state, and the state is retained. On the other hand, once the initial value sharing status is revoked, these statements do not currently free up any memory, but provide the local instance of the static box with appropriate initial values.

  • If the line type of an internal table contains a static box, no table sharing takes place.