Ansicht
Dokumentation

ABENLOOP_GROUP_BY_VALUES_ABEXA - LOOP GROUP BY VALUES ABEXA

ABENLOOP_GROUP_BY_VALUES_ABEXA - LOOP GROUP BY VALUES ABEXA

CPI1466 during Backup   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

- Grouping with LOOP Using Column Values

This example demonstrates the construction of the group key using simple value assignments.

Source Code

Execute

Description

Grouping of an internal table flights with group key binding. The group key of the group loop is constructed as a structure, where the values of the columns carrid or cityfrom of each line of the internal table are assigned to the components carrier and cityfr. This creates groups of lines that have the same value in these columns. Furthermore, the components size and index are created for the special language elements GROUP SIZE or GROUP INDEX to determine the size and index of each group.

The group key that is bound to a reference variable group_ref and the additional components are produced in the group loop. In a member loop, the lines of each group are placed in an internal table members using the value operator with the addition BASE. This table is also displayed.

members could also be filled by evaluating a table comprehension using FOR ... IN GROUP, instead of in a member loop LOOP AT GROUP:

members = VALUE #( FOR flight> IN GROUP group_ref ( <flight> ) ).

The executable example for grouping with FOR demonstrates how the entire group loop can be implemented using expressions.






General Data in Customer Master   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 2537 Date: 20240425 Time: 145222     sap01-206 ( 43 ms )