Ansicht
Dokumentation
ABENCDS_REUSABLE_EXPRESSION_V2 - CDS REUSABLE EXPRESSION V2
ABAP Short Reference PERFORM Short ReferenceThis documentation is copyright by SAP AG.
- CDS View Entity, $projection
... $projection.reuse_exp ...
Effect
$projection.reuse_exp reuses expressions defined in the SELECT list select_list of a CDS view entity in an operand position of the SELECT list of the same CDS view entity.
Reuse expressions can currently be used in the following operand positions:
- In the SELECT list as part of an expression.
- In the ON clause of an CDS association (as described in topic CDS DDL - CDS View Entity, ASSOCIATION.
The reused expression reuse_exp can contain the following operands or expressions:
- A field of a data source data_source of the current CDS view entity
- a literal
- Cycles must not occur and result in a syntax check error.
- The following represents a cycle and is not allowed.
-
... {
a + $projection.z as x,
2 * $projection.x as y,
b + $projection.y as z
} ...
Explanation: element x uses z, which in turns uses y, which again uses x.
- Currently, reuse expressions can't be used in the WHERE, GROUP BY, or HAVING clause or within a filter condition.
- Parameters, session variables, path expressions, and aggregate functions are currently not possible as part of the reuse expression. If you try to reuse such an element of the SELECT list, an error message occurs.
- If a field is specified as CDS amount field or CDS quantity field by assigning a currency key or unit key, and if this field is reused in the same view with $projection, then the reference information is lost and the field is handled as normal numeric value.
- If a calculated quantity is reused via $projection, the reference information is lost, but the characteristic as calculated quantity is kept. The required reference information needs to be assigned to the result.
Example
Reuse of expressions in a SELECT list.
BAL Application Log Documentation ABAP Short Reference
This documentation is copyright by SAP AG.
Length: 5473 Date: 20240329 Time: 065151 sap01-206 ( 61 ms )