SAP PATH EXPR IN COLSPEC ABEXA



Get Example source ABAP code based on a different SAP table
  



Path Expressions, Use in the SELECT List
This example demonstrates path expressions in the SELECT list in AB_SQL .

ABAP_SOURCE_CODE
DEMO CL_DEMO_CDS_ASSOCIATION_PATH

ABAP_DESCRIPTION
The first SELECT statement accesses the CDS view entity demo_cds_assoc_scarr:
DDLS DEMO_CDS_ASSOC_SCARR
This view entity exposes its CDS association _spfli in its SELECT list. The CDS association _spfli uses the view entity demo_cds_assoc_spfli as an association target:
DDLS DEMO_CDS_ASSOC_SPFLI
This view entity exposes its CDS associations _sflight and _sairport in its SELECT list, making it possible to specify them in path expressions after _spfli . These CDS associations use wrappers of DDIC database tables as data sources.
The SELECT statement contains three path expressions in its SELECT list alongside an elementary column specification. The first association contains only the CDS association _spfli of the CDS view entity demo_cds_assoc_scarr specified after FROM. The CDS associations of the data source of the root element are added to the other two path expressions. The path expressions specify the cardinality of the associations, which prevents syntax check warnings indicating that the path expressions affect the cardinality of the result set.
The second SELECT statement demonstrates which joins must be created in AB_SQL to achieve the same result. This is guaranteed by an assertion.
The third SELECT statement accesses the CDS view entity demo_cds_use_assocs:
DDLS DEMO_CDS_USE_ASSOCS
This view shows how the same paths specified in the SELECT statement of the view in CDS DDL syntax and also achieves the same result.
Finally, a fourth SELECT statement accesses the CDS view entity demo_cds_outer_joins:
DDLS DEMO_CDS_OUTER_JOINS
In this view, the same result is again achieved using joins.