首页 > SAP > HANA > Aggregate Expressions in ABAP CDS Views
2019
08-27

Aggregate Expressions in ABAP CDS Views

In the above example ABAP CDS view selects the total stock of the product by using the aggregate function SUM and GROUP BY product and category.

1.2MAX

In the above example ABAP CDS view selects the maximum sale-ale settingss amount generated by the customer by using the aggregate function MAX and GROUP BY business partner.

2.3MIN

In the above example ABAP CDS view selects the minimum sale-ale settingss amount generated by the customer by using the aggregate function MIN and GROUP BY business partner.

3.4COUNT( * )

In the above example ABAP CDS view selects the total number of sale-ale settingss order created against the business partner by using the aggregate function COUNT( * ) and GROUP BY business partner.

4.5COUNT( DISTINCT )

In the above example ABAP CDS view selects the total number of sale-ale settingss order created against the product by using the aggregate function COUNT( DISTINCT ) and GROUP BY product id.

4.1.1.Points to be remembered

Every aggregate expressions used need an alternative element name defined using AS.
Aggregate expressions should require GROUP BY clause.
All non-aggregated fields used in CDS view should be specified in the GROUP BY clause.

Congrats! You have successfully learned different Aggregate Expressions in ABAP CDS Views. Please stay tuned for ABAP CDS View tutorials. Leave a comment in the below comment section and let us know your feedback.