on 10-10-2017 10:43 AM
Hi,
I should use a calculated columns for other calcs in my CDS View, for example
Order.GrossValue as GrossValue,
Order.NetValue as NetValue,
GrossValue - NetValue = Gain
Gain / 1000 = Gain1000
Gain is not usable because is not known as column.
Is there any Annotation or can I know which is the best practice to reuse calc columns in the same CDS view.
Thank you
It is not possible to refer to a calculated field in an other calculated field unfortunately.
So you have to do the same calculation in the second field as well
For example, following code can be used in a CDS view
select
vbeln,
netwr,
mwsbk,
netwr + mwsbk as total,
( netwr + mwsbk ) * 1000 as total1000
from vbrk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Antonio,
Instead of creating calculated values in CDS views, if possible you can define these values in tables as computed columns
Here is an example
create column table Table1 (
Multiplicand int,
Multiplier int,
Product int as Multiplicand * Multiplier
);
insert into Table1 values (2,5);
select * from Table1;
Here is the result
Does it help?
Or you need it really on CDS views? If so, can you give more detail with a sample code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.