SAP CDS DATA SOURCE V2



Get Example source ABAP code based on a different SAP table
  


• AS ABAP_CDS_SELECT_DS

ABAP_CDS_DDL - CDS View Entity, SELECT, data_source

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

What does it do?
Defines a data source of a CDS view entity . A data source can be a DDIC database table, a CDS view entity, a CDS table function, a CDS hierarchy, or a ABAP_CDS_V1_VIEW .
The data source is specified either directly using its name entity or using a path expression path_expr in which CDS associations are evaluated. Non-SQL CDS entities are not possible as association target of the path expression.
If the data source is a CDS entity with a list of input parameters, actual parameters must be passed to these using parameters.
An alias name alias for a directly specified data source can be defined after AS. The name must comply with the naming rules for names.
The syntax JOIN can be used to combine multiple data sources as joins.



Latest notes:

If the data source after FROM is specified as a path expression and if, additionally, the view defines an association, then there is a conflict because in the ON condition of an association, it is not possible to specify a path expression. To prevent this conflict, the following options are available:
Use the $projection syntax in the ON condition
Assign an alias name to the data source
Resolve the path expression and use the association target as prefix in the ON condition.
For an overview of all possible data sources of all available CDS entities, see Data Source Matrix.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Defines the CDS view entity DEMO_CDS_DATA_SOURCE with two data sources:
The first data source demo_cds_param_view_entity requires values for three input parameters. It is assigned the alias name source1 . To use this data source in the SELECT list, the alias name source1 must be used as prefix.
The second data source scarr is defined using an inner join. It is assigned the alias name _source2. To use this data source in the SELECT list, the alias name _source2 must be used as prefix.
DDLS DEMO_CDS_DATA_SOURCE
ABAP_EXAMPLE_END