ARTICLE
Static Boxes
Static boxes are boxed component s
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 for a static box. The
internal reference points to an appropriate initial value for the
structure type, which is stored exactly once in each
application server 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:
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 known
statically. In static boxes, the same functions are available as those
available for a normal component 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.
Notes
Static boxes can be used to optimize the memory requirement of
structures that are used more than once. If, for example, the row str
ucture 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 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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved