Ansicht
Dokumentation

ABENCDS_REUSABLE_EXPRESSION_V2 - CDS REUSABLE EXPRESSION V2

ABENCDS_REUSABLE_EXPRESSION_V2 - CDS REUSABLE EXPRESSION V2

ABAP Short Reference   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- 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.

The reused expression reuse_exp can contain the following operands or expressions:

  • 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.
  • 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 )