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.
- If the data source is a CDS entity with a list of input parameters, actual parameters must be passed to these using parameters.
- 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.
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.
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:
define view business_partner as
select from snwd_bpa
partner{ key partner.bp_id,
partner.company_name,
partner.bp_role }