Ansicht
Dokumentation

ABENCDS_HAVING_CLAUSE_V1 - CDS HAVING CLAUSE V1

ABENCDS_HAVING_CLAUSE_V1 - CDS HAVING CLAUSE V1

CPI1466 during Backup   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

- DDIC-Based View, SELECT, HAVING

... HAVING cds_cond ...

Effect

Defines a HAVING condition for the result set of a after a GROUP BY clause is evaluated. A HAVING condition can only be specified together with GROUP BY. For the operands, general and special rules apply when specifying the condition.

Removes all rows from the result set that do not meet the condition cds_cond specified after HAVING.

Note

Aggregate expressions can be specified in the HAVING condition, which is not possible in the WHERE condition.

Example

When accessed, the CDS view sales_order returns the number of business partners for each business partner role in which the total gross amount in euros is greater than 100000.00.

@AbapCatalog.sqlViewName: 'SALES_ORDER_VW'
define view sales_order as
  select from snwd_so
    inner join
      snwd_bpa on buyer_guid = snwd_bpa.node_key
  {  key bp_role as role, //e.g. customer or supplier
     count(distinct buyer_guid) as partners_count,
     sum(snwd_so.gross_amount) as sum_gross_amount }
  where snwd_so.currency_code = 'EUR'
  group by bp_role
  having sum(snwd_so.gross_amount) > 100000.00;






General Material Data   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 3032 Date: 20240425 Time: 055417     sap01-206 ( 34 ms )