Ansicht
Dokumentation

ABENSTATIC_BOXES - STATIC BOXES

ABENSTATIC_BOXES - STATIC BOXES

BAL_S_LOG - Application Log: Log header data   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.
SAP E-Book

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 have been executed, initial value sharing applies to a static box. The internal reference refers to a type-dependent initial value of the structure, which is stored exactly once for each in its 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 refers to 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 defined at the start of program execution. However, unlike in real dynamic data objects, the length of a static box is always known statically. Static boxes can be used in the same way as a regular component of the same type. When a structure that contains a static box is accessed, however, it should be ensured that it is a deep component.

Notes

  • Static boxes can be used to optimize the memory requirement of structures that are used more than once. If, for example, the line structure of an internal table contains substructures, the memory requirement of the substructure accumulates without the use of static boxes for each line, 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, since 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 affect a static box that has the initial value sharing state like a write statement and the state is retained. 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-specific initial values instead.

Example

Declaration of a substructure scarr as a static box.






BAL Application Log Documentation   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 5056 Date: 20240426 Time: 162237     sap01-206 ( 88 ms )