SAP SELECT AGGREGATE ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• ( ) ABAP_OSQL_AGG_EXP

ABAP_SQLEXP - sql_agg
Short Reference

ABAP_SYNTAX
... agg_func ...

What does it do?
Aggregate expression in AB_SQL . An aggregate expression consists of an aggregate function agg_func that aggregates the values of multiple rows of the result set of a query into a single value. It can be used in the following operand positions:
As an SQL expression for
a column col_spec of the result set in the SELECT list of a query,
an operand on the left side of relational expressions of the condition sql_cond of the HAVING clause of a query. Here, an aggregate expression can be specified directly or as an operand of an SQL expression except for another aggregate expression.
As an operand on the right side of relational expressions of the condition sql_cond of the HAVING clause of a query. Here, no SQL expressions can be used except for directly specified aggregate expressions.
All aggregate functions can be used as an aggregate expression except for PRODUCT. An aggregate function used as an aggregate expression can have one of the following arguments:
An SQL expression sql_exp except aggregate expressions and window expressions for the aggregate functions MAX , MIN, SUM, STRING_AGG, and COUNT.
A column col of a data source of a query for the aggregate functions AVG and GROUPING.
The aggregate functions take the values of the column or the results of the SQL expression of multiple rows of the query result set and determine a single value. Either all rows of the result set or the rows of the current group created using GROUP BY are evaluated. If the value of an aggregate expression is too large for the target area, an exception is raised.



Latest notes:

Table buffering is bypassed when aggregate expressions are used.
NON_V5_HINTS
If SQL expressions other than directly specified columns are specified as arguments of aggregate expressions, the syntax check is performed in a ABAP_STRICT_740_SP08 strict mode / , which handles the statement more strictly than the regular syntax check.
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Returns the flight date, the number of passengers, and the average and maximum luggage weight of all Lufthansa flights with the flight number 0400.
ABEXA 00584
ABAP_EXAMPLE_END

ABAP_EXAMPLES_ABEXA
SQL Expressions, Use in Aggregate Expressions
SQL Expressions, Aggregate Expressions in SQL Expressions
ABAP_EXAMPLE_END

Return to menu