ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Objects →  DATA → 

DATA - BOXED

Short Reference

Syntax

DATA struc TYPE struc_type BOXED.

Effect

This statement defines a structured attribute of a class or an interface as a static box. It can only be located in the declaration section of a class or an interface and only at the highest level.

A structured data type must be specified for struc_type. This can be a local program structured type, a visible structured type of a class or a global interface, or a structure from the ABAP Dictionary, and can contain static boxes.

Static boxes support initial value sharing. The structure is not saved in the higher-level context itself. Instead, an internal reference that points to the actual structure is stored in place of the component. A static box is therefore a deep component.

Notes

Example

The following section shows the allowed usage of the addition BOXED with the statement [CLASS-]DATA. In a class, declares a static structure struc1 and a structured instance attribute struc2 as a static box.

CLASS c1 DEFINITION.
  PUBLIC SECTION.
    TYPES: BEGIN OF t_struc,
             comp1 TYPE c LENGTH 100,
             comp2 TYPE n LENGTH 100,
           END OF t_struc.
  PRIVATE SECTION.
    CLASS-DATA struc1 TYPE t_struc BOXED.
    DATA       struc2 TYPE t100    BOXED.
ENDCLASS.