Ansicht
Dokumentation

ABENSQL_EXPR_IN_AGGREGATES_ABEXA - SQL EXPR IN AGGREGATES ABEXA

ABENSQL_EXPR_IN_AGGREGATES_ABEXA - SQL EXPR IN AGGREGATES ABEXA

Vendor Master (General Section)   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

- Use in Aggregate Expressions

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

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, aggregate functions are used to determine aggregated values whose arguments are 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 aggregate expression that has an arithmetic expression as an argument.

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






BAL Application Log Documentation   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 1799 Date: 20240425 Time: 040230     sap01-206 ( 53 ms )