Skip to Content
G K

CDS View with Case function

Hi Guys,

I've defined a CDS (ZCDS3) which selects from ZCDS1 inner join ZCDS2

with ZCDS1.State = ZCDS2.State

and ZCDS1.city = ZCDS2.city

{

State, city, type

}

The condition here is


If Type = A or B then A or B

else Type = C


I've tried using case statement but it doesn't help since it does a row-by-row search.


Appreciate your help!

Thanks

GK.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 23 at 09:00 AM

    Should be something like this

    CASE
     when Type = 'A' then 'A'
     when Type = 'B' then 'B'
     else 'C'
    END as MyNewField,
    

    btw, you can compare both columns to columns or to constants, you can mix things ,etc.

    More on (self)education:

    https://blogs.sap.com/2019/04/08/education-s4hana-analytics-your-options/

    -----------

    Dmitry Kuznetsov

    BI Consulting

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 23 at 09:36 PM

    Thanks Dmitry!


    I was able to resolve the issue.


    I'll take a look at your blog!

    Add comment
    10|10000 characters needed characters exceeded