Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - DEFINE VIEW →  ABAP CDS - SELECT 

ABAP CDS - SELECT, data_source

Other versions: 7.31 | 7.40 | 7.54

Syntax


... entity[
parameters]|
path_expr [[AS] alias] [
join] ...

Effect

Defines a data source of a CDS view. A data source can be a database table defined in ABAP Dictionary , a database view, an external view , or a non-abstract CDS entity (a CDS view, a CDS table function, or a CDS hierarchy.

  • The data source is specified either directly using its name entity or using a path expression path_expr in which CDS associations are evaluated. The CDS associations of the path expression cannot have any abstract target data sources.
  • An alternative name alias for a directly specified data source can be defined after AS. In fact, AS can be left out. An alternative name must be defined if a path expression is used. The name must comply with the naming rules for names.
  • The syntax join can be used to join multiple data sources as joins.


Example

Defines the CDS view business_partner for the database table snwd_bpa, for which an alternative name partner is specified. This name is used in the SELECT list.

@AbapCatalog.sqlViewName: 'BPA_VW'
define view business_partner as
  select from snwd_bpa as partner
         { key partner.bp_id,
           partner.company_name,
           partner.bp_role }

as can also be omitted in front of the alternative name partner. The following example demonstrates another valid spelling that is potentially confusing:

@AbapCatalog.sqlViewName: 'BPA_VW'
define view business_partner as
  select from snwd_bpa
           partner{ key partner.bp_id,
                    partner.company_name,
                    partner.bp_role }

Continue

ABAP CDS - SELECT, parameters

ABAP CDS - SELECT, JOIN