cancel
Showing results for 
Search instead for 
Did you mean: 

CASE WHEN

Former Member
0 Kudos

Can somebody refer me to syntax for using CASE and WHEN or may be both together in macros?

I got a logic where I have to say

If

Condition is true

case when

Row value >50

CELL_BG (6)

when

Row value <50

CELL_BG (5)

end if.

I am getting an error saying "CASE is not part of Data statement.

Where am I going wrong?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

srinivas_krishnamoorthy
Active Contributor
0 Kudos

Try to use

IF <<CONDITION 1>> THEN <<DO 1>> ELSEIF <<CONDITION 2>> THEN <<DO 2>> ENDIF ENDIF kind of structure instead. You can have multiple ELSEIFs.

Former Member
0 Kudos

Hi Srinivas,

Thank you. using If and ELSEIF works. I am wondering what the syntax of CASE WHEN is? Event he macro documentation doesn't talk about it. I found this [link|http://help.sap.com/saphelp_scm40/helpdata/EN/fc/eb34ef358411d1829f0000e829fbfe/frameset.htm]

but the macros doesn't seem to support that.

What would be the syntax if I were to use CASE and WHEN.

Thanks.

Former Member
0 Kudos

Hi Raj.

In the macro workbench, there is SAP example and template macros. Within that there is a macro called "Using the case statement"

This gives an example of the syntax which shows how it should be done.

Hope this helps, M