Skip to content

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.

  1. 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.

    HAVING Clause-Aggregation

  2. Navigate to tab HAVING Clause .

  3. Enter a HAVING Clause using the syntax in accordance to your SAP Release, e.g., COUNT(BRGEW) > 10.
    HAVING Clause
  4. 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 .


Last update: June 17, 2024