Ansicht
Dokumentation

ABENCDS_HAVING_CLAUSE_V2 - CDS HAVING CLAUSE V2

ABENCDS_HAVING_CLAUSE_V2 - CDS HAVING CLAUSE V2

CL_GUI_FRONTEND_SERVICES - Frontend Services   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

- CDS View Entity, SELECT, HAVING

... HAVING cds_cond ...

Effect

Defines a HAVING condition for the result set of a CDS view entity after a GROUP BY clause is evaluated. A HAVING condition can only be specified together with GROUP BY. The HAVING condition removes all rows from the result set that do not meet the condition cds_cond specified after HAVING.

If the view entity makes use of multiple data sources by using join expressions, then all fields listed after HAVING must be prefixed with the name of their data source separated by a period (.). The prefix is required in all cases, even if the field names are unique.

The following rules apply to the condition specified after HAVING:

  • As relational operators, comparison operators, LIKE, and IS [NOT] NULL can be used. BETWEEN and IS INITIAL are not supported.
  • The Boolean operators NOT, AND, and OR are allowed.
when using the operator LIKE, then rhs must be a character literal.
  • A field of a data source can be specified using a path expression path_expr.element, as long as the CDS associations of the expression do not have any non-SQL CDS entities as association targets and all associations traversed have the cardinality to-one:

element can be used to specify an element of the association target of the last CDS association of the path.
  • Other expressions and function calls are not allowed.

Note

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

Example

When accessed, the CDS view entity DEMO_CDS_VIEW_ENTITY_HAVING returns details about all flights that have a maximal seats capacity of more than 500 seats.






CL_GUI_FRONTEND_SERVICES - Frontend Services   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 6600 Date: 20240509 Time: 001828     sap01-206 ( 71 ms )