SAP LOOP GROUP BY OVERLAP ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_ITAB - Grouping with LOOP in Overlaps
This example demonstrates the construction of the group key if conditions overlap.

ABAP_SOURCE_CODE
DEMO CL_DEMO_LOOP_GRP_BY_OVERLAP

ABAP_DESCRIPTION
This example works in a similar way to the executable example for constructions using comparison expressions. The following shows how the result of comparison expressions that overlap depends on the order in which the expressions are evaluated.
In the first group loop,
those lines are identified first whose value is less than or equal to 5,
then the lines whose value is between 2 and 7,
then the lines whose value is greater than 5.
In the second group loop,
those lines are identified first whose value is between 2 and 7,
then the lines whose value is less than or equal to 5,
then the lines whose value is greater than 5.
The result of this is that the lines with the values 3, 4, and 5 are assigned to different groups. The group assignments of the lines would not change, however, even if the internal table were sorted differently.
The executable example for grouping with FOR demonstrates how the entire group loop can be implemented using expressions.