I want to transfer this SQL script code to CE functions:
select
A.MANDT,
A.ORGEH,
A.ORGLV,
A.S_PLANS,
A.S_PERNR,
b.ENAME as ENAME,
(case
when a.ORGLV = 'ROOT' then 'ROOT - ALL Chief'
when a.S_PERNR is null then ''
when b.ENAME is null then a.S_PERNR
else a.S_PERNR||' - '||b.ENAME end) as CA_LV_CHIEF
from : "Table1" as a left outer join "Table2" as b
on b.PERNR = a.S_PERNR
AND A."MANDT" = B."MANDT"
group by A.MANDT, A.ORGEH, A.S_PERNR, A.S_PLANS, A.ORGLV, b.ENAME
My question is about the calculated attribute CA_LV_CHIEF
. You can see there are multiple when...then
statements in the original SQL. I want to use CE_CALC()
function to convert it to CE function, but I don't know how to nest CASE
statement in it.
If possible, how can I do it; or if not possible, is there any other way to convert it to a CE function? Thanks