SAP ABAP SQL PATH FILTER



Get Example source ABAP code based on a different SAP table
  


• [ ] ABAP_OSQL_PATH
• * ABAP_OSQL_PATH
• ONE TO ONE ABAP_OSQL_PATH
• ONE TO EXACT ONE ABAP_OSQL_PATH
• ONE TO MANY ABAP_OSQL_PATH
• EXACT ONE TO EXACT ONE ABAP_OSQL_PATH
• EXACT ONE TO ONE ABAP_OSQL_PATH
• EXACT ONE TO MANY ABAP_OSQL_PATH
• MANY TO EXACT ONE ABAP_OSQL_PATH
• MANY TO ONE ABAP_OSQL_PATH
• MANY TO MANY ABAP_OSQL_PATH
• INNER ABAP_OSQL_PATH
• LEFT OUTER ABAP_OSQL_PATH
• WHERE ABAP_OSQL_PATH

AB_SQL - Path Expressions, attributes

ABAP_SYNTAX
... [ $[$[cardinality$] $[INNER$|${LEFT$|RIGHT OUTER$}$]$] $[$[WHERE$] sql_cond$] ]
$| [ $[$[INNER$|${LEFT$|RIGHT OUTER$}$] $[cardinality$]$] $[$[WHERE$] sql_cond$] ]...

ABAP Addition
1 ... cardinality
2 ... INNER$|${LEFT$|RIGHT OUTER$}
3 ... $[WHERE$] sql_cond

What does it do?
Attributes for a section of a path expression can be specified in square brackets for every CDS association or CTE association _assoc of the path expression specified in a data source of a FROM clause or a column specification. The following can be done using these attributes:
The cardinality cardinality of the section can be declared.
The type of the join expression can be specified.
A filter condition sql_cond can be specified.

ABAP Addition

What does it do?
The cardinality cardinality of the current association _assoc is declared.
The cardinality can either be specified in syntax written in words or in numeric syntax in parentheses. The syntax written in words can specify a source and a target cardinality, while the numeric syntax only specifies a target cardinality. The syntax written in words is recommended.
Cardinality syntax written in words:
ONE TO ONE
ONE TO MANY
ONE TO EXACT ONE
EXACT ONE TO ONE
EXACT ONE TO MANY
EXACT ONE TO EXACT ONE
MANY TO ONE
MANY TO MANY
MANY TO EXACT ONE If specified, the join type must precede the cardinality specification. For example: _assoc[ INNER MANY TO ONE ]-field AS alias.
Numeric cardinality syntax:
The target cardinality can be specified by the numbers 1 or 2 or by specifying the character * in parentheses ( ) . If specified, the join type must be placed after the cardinality specification. For example: _assoc[ (1) INNER ]-field AS alias. If the cardinality is specified as (1), a LEFT OUTER JOIN is defined implicitly using the addition MANY TO ONE on database systems that support this, and the consequences of this should be noted.
Specifying the cardinality overwrites the original definition of the cardinality cardinality or TO ONE$|MANY of the current association with the new cardinality.
The cardinality can be specified to prevent syntax warnings or syntax errors in cases where the cardinality of the association does not match the way it is used in a path expression of a SELECT statement or affects the way it is used.



Latest notes:

NON_V5_HINTS
If the cardinality is specified in a path expression, the syntax check is performed in ABAP_STRICT_791 strict mode from ABAP_RELEASE ABAP_791 / .
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Paths specified with an explicitly specified cardinality of CDS associations in the SELECT list. If supported by the database, only the left outer join between the DDIC database tables SPFLI and SAIRPORT is defined using the addition MANY TO ONE.
ABEXA 01202
ABAP_EXAMPLE_END

ABAP Addition

What does it do?
This addition defines the join type into which the current association _assoc is transformed:
INNER specifies an inner join.
LEFT$|RIGHT OUTER specifies a left outer join or a right outer join.
The join type can only be specified together with the cardinality.
If the join type is not specified explicitly, the type depends on the place where the path expression is used:
When columns are specified in SELECT statements, a LEFT OUTER JOIN is used.
An INNER JOIN is used as a data source of the FROM clause.



Latest notes:

NON_V5_HINTS
If the type of the join is specified in a path expression, the syntax check is performed in ABAP_STRICT_769 strict mode from ABAP_RELEASE ABAP_769 / .
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Path specifications with an explicitly specified cardinality and a switch of the left outer joins to inner joins in the columns specified in the SELECT list.
ABEXA 01203
ABAP_EXAMPLE_END

ABAP Addition

What does it do?
Specifies a filter condition sql_cond for the current association _assoc. The addition WHERE is optional in cases where the filter condition is the only item specified in the square brackets. The addition must be specified if one of the other additions is used first.
When the association is resolved in a join, the filter condition is converted to an extended condition for the join. If no filter condition is specified in the path expression, the default filter condition defined using WITH DEFAULT FILTER is used in the case of a CDS association.
Columns specified in the filter condition sql_cond always refer to the target target or target of the association for which the condition is specified. An explicit name must not and cannot be specified with the column selector ~ in front of a column specification.



Latest notes:

The relational expressions that can be used in a filter condition are a subset of the relational expressions for statements, but also allow SQL expressions as operands on the right side.
NON_V5_HINTS
If a filter condition is specified in a path expression, the syntax check is performed in ABAP_STRICT_767 strict mode from ABAP_RELEASE ABAP_767 / .
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Specification of filter conditions in a path expression.
ABEXA 01204
ABAP_EXAMPLE_END