Ansicht
Dokumentation

ABENSQL_EXPR_AGGR_IN_EXPR_ABEXA - SQL EXPR AGGR IN EXPR ABEXA

ABENSQL_EXPR_AGGR_IN_EXPR_ABEXA - SQL EXPR AGGR IN EXPR ABEXA

General Material Data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- Aggregate Expressions in SQL Expressions

This example demonstrates aggregate expressions as an argument of SQL expressions.

Source Code

Execute

Description

The DDIC database table DEMO_EXPRESSIONS is filled with random values in the static constructor.

  • The first SELECT statement reads the filled columns individually. Here, the total and the product of the numeric columns NUM1 and NUM2 are calculated using arithmetic statements in the SELECT list.
  • The second SELECT statement performs a grouping by the columns CHAR1 and CHAR2. For each group, aggregated values whose arguments are aggregate expressions are determined using arithmetic expressions.
  • The third SELECT statement performs the same grouping as the second SELECT statement, but restricts the selected groups using a HAVING clause in which a condition is set on an arithmetic expression that has aggregate expressions as arguments.

See also the executable example for using SQL expression in aggregate expressions. Here, the roles of the expressions are switched, and different results are produced.






PERFORM Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 1811 Date: 20240426 Time: 123746     sap01-206 ( 34 ms )