CASE WHEN SUBSTRING ( "VBAP"."MATNR", 0, 2 ) = '60' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 2 ) = '64' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '647731' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '664402' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '664403' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666161' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666162' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666931' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666986' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666987' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669181' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669182' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669183' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669184' then 'Yes'
WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666651-001' then 'Yes'
ELSE 'No'
END
the first condition is not being applied, I see materials that starts with 60 o 64 with a no, I tested on the background and it is returning the value..