cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reuse of Calculated Columns in CDS-View

ibarbaric
Explorer
0 Kudos
652

Hi Experts,

In thread Reuse of Calculated Columns in CDS View, a solution was posted:

select 
  vbeln,
  netwr,
  mwsbk,
  netwr + mwsbk as total,
  ( netwr + mwsbk ) * 1000 as total1000
from vbrk

Note that there is redundancy here: the expression "netwr + mwsbk" occurs twice. This is OK for such a simple case. However, my calculated fields are much more complex and I would like to reuse existing expressions (already created calculated fields), as:

select 
  vbeln,
  netwr,
  mwsbk,
  netwr + mwsbk as total,
  total * 1000 as total1000
from vbrk

I tried:

  1. Exactly as above: I got error message "The column 'total' is unknown"
  2. With prefix $projection.total: error message "Reuse of $projection expression not possible"
  3. I created a second CDS View which reads from the first one, and then I reused the second as association in the first one. I got error message "Recursive definitions are not supported" (which makes sense)

Are there any ideas?
Thanks!
Igor

 

Accepted Solutions (0)

Answers (0)