Ansicht
Dokumentation
ABENOPEN_SQL_PATH - OPEN SQL PATH
CPI1466 during Backup CPI1466 during BackupThis documentation is copyright by SAP AG.
- SQL path expressions sql_path
... $[source~$]\_assoc1$[sql_para$]$[attributes$]
$[\_assoc2$[
sql_para$]$[attributes$]$]
$[\...$] ...
Effect
Specifies an SQL path expression. 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 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 an CDS abstract entity or whose association targets are an CDS abstract entity.
When a SELECT statement is compiled using path expressions, the joins represented by these expressions are implicitly added to the FROM clause of the statement. The resulting additional data sources are implicitly evaluated at the occurrences of the path expressions. This respects the join conditions of the associations and the other conditions of the CDS entities or common table expressions in question. 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 before 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 leads directly to the exposed unit 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 1", 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 done 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 in parameter passing
- In blanks in parentheses in square brackets for attributes
Certain restrictions apply to the associations of path expressions in .
Notes
- When the associations of the path expressions are defined as joins, they are mapped 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 be used in the same operand positions too.
- No path expressions can be created using CDS associations that are exposed in the element list of CDS abstract entities.
- If parameters are passed or attributes specified in a path expression of a specified column, the syntax check runs in strict mode from Release .
Example
Simple path specified for the CDS association _spfli_scarr from the following CDS view:
The program 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.
A SELECT statement that access the full SELECT list of the view and a SELECT statement that accesses a view with a join of the same type produce the same result.
General Material Data ABAP Short Reference
This documentation is copyright by SAP AG.
Length: 10585 Date: 20240424 Time: 170545 sap01-206 ( 114 ms )