What does it do? Specifies an SQL path expression. AB-SQL statements can contain path expressions in certain operand positions whose root element must be a CDS association or CTE association exposed as follows:
In the same SELECT statement of a query, the name of the CDS entity is used to access one of the following data sources:
A CDS view entity that exposes the CDS association in its SELECT list.
A ABAP_CDS_V1_VIEW that exposes the CDS association in its SELECT list.
A CDS hierarchy that exposes the CDS association in its element list.
In a WITH statement, the association with the addition WITH ASSOCIATIONS is exposed by a preceding common table expression. This can be one of the following:
CDS association or CTE association exposed using a path expression.
CTE association defined and exposed for the common table expression. In a path expression, the names of associations _assoc1, _assoc2, ... are separated by backslashes ( ). Associations specified after the root element must be exposed in the association target of the directly prefixed association in the path expression. No CDS associations can occur that are defined in a CDS abstract entity or whose association targets are a CDS abstract entity. When a SELECT statement with path expressions is compiled, the joins represented by them are implicitly inserted in the FROM clause of the statement and the resulting additional data sources are implicitly evaluated at the usage locations of the path expressions. The join conditions of the associations and the other conditions of the CDS entities or common table expressions involved are respected. Path expressions can be used:
In the specified columns of SELECT statements of queries. The path expression represents a left outer join (LEFT OUTER JOIN ) by default.
As a data source of the FROM clause in queries. The path expression represents an inner join (INNER JOIN) by default.
To expose an association of a common table expression in the WITH statement. When specifying columns and when exposing an association, an optional source unit can be specified in front of the path expression, separated by a column selector ~. The first association of this unit is exposed. This is either a CDS view, a CDS hierarchy, or a common table expression. However, when used as a data source, the path expression follows the exposed unit directly anyway. An association has the cardinality defined implicitly or explicitly in the CDS entity or common table expression by default. Syntax warnings or syntax errors occur when the cardinality does not match the way the path expression is used in the SELECT statement. If the association has the cardinality to one , the addition MANY TO ONE is added implicitly in the case of a LEFT OUTER JOIN on databases where this is supported. The consequences of this behavior should be noted. The following can be specified after an association:
Actual parameters can be passed to input parameters of the data source of a CDS association by using sql_para .
The following attributes can be specified for the section of the path expression using attributes:
Cardinality of the association
Category of the join expression
Filter conditions A path expression can be split across multiple lines of source code at the following places:
In front of a backslash ( ), but not in the SELECT list
In blanks in parentheses of parameter passing
In blanks in square brackets for attributes Certain restrictions apply to the associations of path expressions in AB_SQL .
Latest notes:
When the associations of the path expressions are defined as joins, an attempt is made to map them to as few join expressions as possible. Associations with identical parameter passing and semantically identical attributes generally produce only one join expression.
If the specified columns of different clauses are checked for matches in a SELECT statement, any parameters specified and attributes are also checked. Here, the same host variables must also be used in the same operand positions.
No path expressions can be created using CDS associations that are exposed in the element list of CDS abstract entities. NON_V5_HINTS
If parameters are passed or attributes specified in a path expression of a specified column, the syntax check runs in ABAP_STRICT_769 strict mode from ABAP_RELEASE ABAP_769 / . ABAP_HINT_END
ABAP_EXAMPLE_VX5 Simple path specified for the CDS association _spfli_scarr from the following CDS view entity: DDLS DEMO_CDS_ASSOCIATION_VE The class CL_DEMO_CDS_ASSOCIATION uses the following SELECT statement with the simple path _spfli_scarr for the view and compares it with accesses to the data that work in the same way. ABEXA 01201 A SELECT statement that accesses the entire SELECT list of the view and a SELECT statement that accesses a view with a join of the same type produce the same result. ABAP_EXAMPLE_END
ABAP_EXAMPLES_ABEXA
Path Expressions, Use in the SELECT List
Path Expressions, Use in the FROM Clause ABAP_EXAMPLE_END