cancel
Showing results for 
Search instead for 
Did you mean: 

Create Column with 'IF' or 'Case' functionality

Former Member
0 Kudos

I've been trying to create a new view column with logic similar to :

     If <field> = 'A' then 'Apples'

     else if <field> = 'B' then 'Bananas' ....

     Case <field>        

           When 'A' then 'Apples'         

          When 'B' then 'Bananas'

          etc ....

I've read that 'IF' cannot be used in the New Column editor; I did try anyway (as SAP documentation not always correct) but could not get it to work.

Could not find reference to a CASE statement.

Does anyone know if a function/statement or other workaround that could be used to get this logic to work ?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos


Hi Simon,

You can use decode((<field> = 'A'), 'Apples', (<field> = 'B'), 'Bananas', 'Unknown')

Regards

Nigel

Former Member
0 Kudos

Many thanks Nigel !
Not as neat as CASE, but just as good as IF ELSE.

Solved my problem, appreciated

Answers (0)