ABAP_DESCRIPTION The task of splitting the lines in a single one-column table into three groups by comparison criteria is solved in two different ways:
The method group_explicit> works without GROUP BY>. Instead, the grouping takes place explicitly in the ABAP class, which requires an explicit helper table helper_tab>. After the grouping, the lines of the nested table refs> in helper_tab> point to the associated lines of the original table numbers> for each group defined using the column key>. This grouping loop is followed by the group loop across the helper table, where every loop pass accesses the group members by evaluating the nested tables refs>.
The method group_by> works with GROUP BY>. The result matches the result of group_explicit>. A comparison of the methods shows that the grouping loop of the first method in the second method is done implicitly by GROUP BY>> and no explicit helper table is required. Only the group loop can be seen. Both methods perform three types of loops, the grouping loop, the group loop, and the optional member loops. Using GROUP BY> is easier since the grouping loop does not need to be programmed explicitly and the second method becomes significantly shorter.