Ansicht
Dokumentation

ABENLOOP_GROUP_BY_LEVELS_ABEXA - LOOP GROUP BY LEVELS ABEXA

ABENLOOP_GROUP_BY_LEVELS_ABEXA - LOOP GROUP BY LEVELS ABEXA

CL_GUI_FRONTEND_SERVICES - Frontend Services   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- Grouping with LOOP in Group Levels

This example demonstrates simple group level processing using GROUP BY.

Source Code

Execute

Description

This example works in the same way as the executable example for group level processing. Here, the group key is constructed explicitly using the value of the column col1 and, unlike in group level processing, does not depend on the structure of the table and its sorting.

The statement SUM is replaced by a functional method that replaces the implicit behavior of the statement with an explicit and self-definable function.

group and sum could also be filled by the evaluation of a table comprehension or table reduction using FOR ... IN GROUP, instead of in a member loop LOOP AT GROUP:

sum = REDUCE #( INIT s = VALUE line( )
                FOR line IN GROUP line>
                NEXT s = sum( EXPORTING line = line
                                        base = s ) ).
group = #( FOR wa> IN GROUP line> ( wa> ) ).

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






Vendor Master (General Section)   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 2286 Date: 20240425 Time: 103223     sap01-206 ( 29 ms )