Use negative LIKE

Hello,

I look everywhere and seem that there’s no way to perform a negative like in a statement.
I’m trying to create a save formula by doing something like the following example:

CASE
WHEN “VBAK”.“VKORG” = ‘E100’
AND “VBAK”.“VTWEG” = ‘11’
AND (ISNULL(“VBAP”.“ABGRU”) = 1 OR “VBAP”.“ABGRU” IN (’’, ‘50’, ‘99’, ‘Y8’))
AND “VBAK”.“AUART” IN (‘YOPA’, ‘YOPB’, ‘YOPD’, ‘YVPE’)
AND “VBAP”.“BS_UNIT_TEXT” NOT LIKE ‘%CS%’
THEN ‘Product’
WHEN “VBAP”.“BUKRS_LAND1” = ‘US’
AND “VBAP”.“ABGRU” = ‘’
AND “VBAP”.“DIVISION” = ‘SSI’
AND “VBAK”.“VKBUR” IN (‘BIL4’,‘BNJ4’)
AND “VBAP”.“PSTYV” NOT IN (‘YFP4’,‘YOP4’)
AND “VBAP”.“BS_UNIT_TEXT” NOT LIKE ‘%CS%’
THEN ‘Product’
WHEN “VBAP”.“BUKRS_LAND1” = ‘US’
AND “VBAP”.“BS_UNIT_TEXT” LIKE ‘%CS%’
THEN ‘Service’
ELSE ‘Unclassified’
END

Is there any workaround that let me use this type of approach?

Thanks in advance.
BR,
João Bué

Good Morning João,

I was a little surprised and checked that. The operator “NOT LIKE” is available and works (I checked this for Celonis On Premise Version 4.6 and Celonis IBC).

Maybe your case-when statement is not yet correct.

“The CASE statement goes through conditions and returns a value when the first condition is met . So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in the ELSE clause.”

CASE
WHEN condition1 THEN result1 (AND GOTO END)
WHEN condition2 THEN result2 (AND GOTO END)
WHEN conditionN THEN resultN (AND GOTO END)
ELSE result (AND GOTO END)
END;

Best regards,

Kay

1 Like