Skip to content

ABAP Keyword Documentation →  ABAP Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Views →  ABAP CDS - DDL Statements →  ABAP CDS - DEFINE VIEW →  ABAP CDS - SELECT →  ABAP CDS- SELECT, clauses 

ABAP CDS - SELECT, WHERE

Other versions: 7.31 | 7.40 | 7.54

Syntax


... WHERE cond_expr ...

Effect

Defines a WHERE condition for the results set of a CDS view in ABAP CDS. When the CDS view is accessed, the results set contains only the data from the data source data_source that meets the condition cond_expr specified after WHERE.

The fields evaluated in the condition do not need to be defined as elements of the CDS view in the SELECT list. Special rules apply when specifying the condition.


Note

Unlike in the HAVING condition, aggregate expressions cannot be specified in the WHERE condition.


Example

When the CDS view sales_order is accessed, the results set contains only orders where the company name of the business partner starts with "S" and that were created between January and March 2013.

@AbapCatalog.sqlViewName: 'SALES_ORDER_VW'
define view sales_order as
  select from snwd_so
         association to snwd_bpa as partner
                     on snwd_so.buyer_guid = partner.node_key
         { key so_id,
               snwd_so.buyer_guid,
               partner.company_name,
               snwd_so.created_at,
               @Semantics.currencyCode currency_code,
               @Semantics.amount.currencyCode: 'currency_code' gross_amount
         }
         where partner.company_name like 'S%' and
                       created_at between 2013010100000.0
                                     and 20130401000000.0; //Jan-March