SAP SQL EXPR OVER GROUP ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_SQLWIN - Window Expressions with Grouping
This example demonstrates window expressions for a grouped result set.

ABAP_SOURCE_CODE
DEMO CL_DEMO_SELECT_OVER_GROUP

ABAP_DESCRIPTION
The example shows the combination of window expressions in the SELECT list with a GROUP BY clause. In this case, aggregate functions used as a window function can also have aggregate functions as arguments.
The GROUP BY clause groups by the columns CHAR1 and CHAR2. In the result set created by this, OVER is used to define windows whose window criterion is the column CHAR1. Aggregate expressions that can be specified as columns in the SELECT list due to the GROUP BY clause are also used as arguments of window functions.
The aggregate functions used as an argument of window functions would not need to appear as separately specified columns in the SELECT list but are shown here anyway to highlight how these values are produced.