HAVING Clause
The HAVING clause can be used to filter groups of rows, see SAP ABAP Documentation: SELECT-HAVING.
Create a HAVING Clause
The following example shows how many materials are assigned to a material type (MTART). After applying the HAVING Clause, the preview shows only the material types with more than 10 materials assigned.
-
Select an aggregate function for a field you want to use in the HAVING-clause.
Note
Aggregate functions are only supported for numeric field types, which is why the field BRGEW (Gross Weight) is used in the example.
-
Navigate to tab HAVING Clause .
- Enter a HAVING Clause using the syntax in accordance to your SAP Release, e.g.,
COUNT(BRGEW) > 10
.
- Click [Load live preview] to display the results in the Preview section.
Note
When fields with the same name exist in different tables, the field names must be formatted as [Table]~[Column], e.g., MAKT~MATNR. This can be the case with table joins.
HAVING Clause Syntax
With regard to syntax and formulas, the same rules apply as for the WHERE Clause. Depending on your SAP release the syntax may varry, see SAP Help - ABAP SQL - SQL Expressions sql_exp .