on 04-26-2021 3:09 PM
Hi experts,
in a aDSO I have to derive a characteristic A according to a complex logic within one row. Usually I'd do that within an endroutine or expert routine. But in my case, A will change in further loads onto this aDSO.
A is a component of another InfoObject B. This is because of a hierarchy within B.
So my problem is: Everytime new data is loaded, I'd have to loop through the entire active data and determine A's new value according to the new and old data. I wondered if there was a more simple way to do that by using something like a "virtual characteristic" whose value is determined at query runtime. Is there something like this or do I really have to loop?
Thanks
Hi David,
you can calculate this with a SQL-Expression a composite provider, as long as this field could be calculated within the row and without accessing other tables. I wrote a blog post about SQL-Expressions in BW/4HANA Composite Providers, that could show you the possibilities at this place.
Can you tell us, how A is calculated?
Regards,
Jörg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jörg,
thanks for the blog post! This seems very helpful. A will be calculated in the following way:
if "MY_CHARACT1" = 'X' then
if "0AMOUNT" < 0 then
"A" = '1'
else
"A" = '2'
end if
else
"A" = 'X'
end if
I'm completely new to SQL Script so I'm not sure if if statements are possible in this way at all or if only case statements are allowed that you mentioned in your video. But "MY_CHARACT1" and "0AMOUNT" are available at the output part of the composite provider.
Hi dsakq ,
you can do this with the CASE Expression. It should look like like this:
CASE WHEN "MY_CHARACT1" = 'X' AND "0AMOUNT" < 0 THEN '1'
WHEN "MY_CHARACT1" = 'X' AND "0AMOUNT" >0 = THEN '2'
ELSE 'X' END
Regards,
Jörg
Thank you Jörg, this has solved my problem!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.