Hi All,
I have a SQL Script calc view that selects set of fields and I need to create a new calculated column like this -
If In_Param = US
if (isNull(Var1))
Var2
else
Var1
else
Var1
endif
the SQL script calc view is as shown below and i try to add it but get the error as highlighted in the below script..
Queries:
Could you please help me please??
1. can i use input parameter In_Param for condition? If no, then what is the alternative to achieve this
2. can i have nested Ifs and/or case statement?
error:
Script
BEGIN /********* Begin Procedure Script ************/
BEGIN
V_TEMP =
SELECT * from <table>
.....
...........
..................
<Filter logic here>
..........................
var_out1 = APPLY_FILTER (:V_TEMP,:v_flt_id);
var_out =
SELECT "J_3AEAN11",
"MATNR",
"VBELN",
"POSNR",
"J_3ASIZE",
"MAKTX",
"ARTNR",
"WERKS",
"NAME1",
"AUART",
"LIFSK",
"CSTFLD02",
<error here>
CASE WHEN :In_Param = 'US' THEN CASE "VAR1" IS NULL THEN "VAR2" ELSE "VAR1" END
ELSE "VAR2" END AS "CM_VAR",
sum("MENGE") AS "MENGE",
sum("J_3ARESM") AS "J_3ARESM"
FROM :var_out1
END /********* End Procedure Script ************/