Ansicht
Dokumentation

ABENTABLE_EXP_CHAINING - TABLE EXP CHAINING

ABENTABLE_EXP_CHAINING - TABLE EXP CHAINING

CL_GUI_FRONTEND_SERVICES - Frontend Services   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

- Chainings

Table expressions can be chained with the structure component selector -, with other table expressions, and with the object component selector ->.

If the constructor operator VALUE or REF is specified before a chaining to control the result, only the final result is affected. Any intermediate results are always temporary field symbols and the corresponding performance notes should be considered.

Note

Chainings of table expressions with functional method calls, that is, specifying the internal table as a functional method call meth( ... )[ ... ] or meth( ... )-comp[ ... ] and accessing the internal table using a chained attribute access meth( ... )->itab[ ... ], are not yet possible. Table expressions cannot currently be placed on the right of a method call in method chainings.

Chainings with the Structure Component Selector

A table expression can be chained as follows using the structure component selector -:

  • If the result of a table expression itab[ ... ] is a structure, the structure component selector can be used to read each component comp of the structure:
... itab[ ... ]-comp ...
If comp has a suitable type, a specified offset/length +off(len) can be appended, except when the chaining is used as a memory area of the statement ASSIGN or as an argument of the reference operator REF.
  • If a structure struct has a table-like component comp, it can be specified as the name of the internal table of a table expression:
... struct-comp[ ... ] ...

Both of these alternatives can be combined, enabling a structured component selector to be located directly on the left and right of a table expression.

Note

If the reference operator REF is specified in front of a chaining whose result is a component of a structured table line, it creates a reference to this component.

Reading of the first column of the second line of the table-like second component of the first line of the internal table itab. The result is 4.

Table Expressions, Chainings

Chainings with Table Expressions

If the result of a table expression itab[ ... ] is an internal table, it can be used as the name of the internal table of a table expression:

... itab[ ... ][ ... ] ...

An expression of this type can

  • itself be continued with square brackets [ ... ], if its result is again table-like.
  • be combined with the information from structure component selectors above.

In an internal table nested twice, reads the first line of the innermost table in the second line of the center table in the second line of the outermost table. The result is 7.

Direct chaining of table expressions and chaining with the structure component selector in a single expression. Reading of the structure component of the innermost nested table with the value 13.

Chainings with the Object Component Selector

If the result of a table expression or one of the preceding chainings has a reference type, these chainings can be placed directly in front of the object component selector to access the components of the referenced object:

... itab[ ... ]->comp ...

... itab[ ... ]-comp->comp ...

... struct-comp[ ... ]->comp ...

... itab[ ... ][ ... ]->comp ...

A component addressed in this way can, depending on its design, be used in all suitable operand positions and particularly in further chainings.

Notes

  • No table expressions can be specified in a write position for a read-only internal table. This also applies when the object component selector is used to access another object. Furthermore, standalone method calls a not possible using a read-only internal table.

Example

Dereferencing a line of an internal table of data reference variables and accessing a single component.

Example

Filling of an internal table of reference variables with object references and accessing attributes and methods of the objects using table expressions in front of the object component selector.






ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 6325 Date: 20240328 Time: 093407     sap01-206 ( 93 ms )