Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  ABAP Syntax →  ABAP Statements →  Operands →  Names for Individual Operands 

Chainings

Whenever operands are grouped together from components, which themselves contain components, the names of these components are composed from chains with multiple component selectors. The following rules apply to these chained names:

  • The names to the left of each structure component selector must, as a combined group, address a structured data type or a structure.
  • The names to the left of each object component selector must, as a combined group, address a reference variable.
  • The class component selector can occur in a name exactly once as the first selector.
  • The interface component selector can only occur more than once in a label if other component selectors are listed between the individual interface component selectors.

Other versions: 7.31 | 7.40 | 7.54


Note

The following chainings are possible alongside chainings or names:

Chainings can be combined in any way as long as their rules are respected.


Example

Declares a nested structured data type struc2 in struc1 and a structure struc3 in an interface i1.

The component comp of struc3 is a data reference variable of the static type struc1. The i1 interface is the component interface of i2 and the latter is implemented in c1. In c2, a static attribute is declared as the object reference of the static type c1. The expression in the last line can be at an operand position that expects a data object, and labels the component comp of the structure struc2 in a chaining that starts at class c2. A prerequisite for use of the expression is that both reference variables, oref and dref, point to the respective instances.

INTERFACE i1.
  TYPES: BEGIN OF struc1,
           ...
           BEGIN OF struc2,
             ...,
             comp TYPE ...,
             ...,
           END OF struc2,
           ...
         END OF struc1.
  DATA: BEGIN OF struc3,
          ...
          dref TYPE REF TO struc1,
          ...
        END OF struc3.
ENDINTERFACE.

INTERFACE i2.
  INTERFACES i1.
ENDINTERFACE.

CLASS c1 DEFINITION.
  PUBLIC SECTION.
    INTERFACES i2.
ENDCLASS.

CLASS c2 DEFINITION.
  PUBLIC SECTION.
    CLASS-DATA oref TYPE REF TO c1.
ENDCLASS.

...

... c2=>oref->i1~struc3-dref->struc2-comp ...