PQL filter - different filtering based on an attribute

Hi everyone,

I am trying to write a load script that would incorporate the below logic, and I am confused with the syntax. Will appreciate any advise.

Analyzing SAP O2C process.

Logic:
If SO Item is for defined materials then this SO Items should be included without any additional filter.
If SO Item is for any other materials (not from that defined set), then for those SO Items additional filter should apply.

Materials that should go without filter: ‘EDIDUMMY’, ‘ILODUMMY’
For every other material I want to exclude those where there is a reason for rejection: ISNULL(“VBAP”.“ABGRU”) = 1;

I tried to write something like this, but after I try to save the script analysis keeps loading forever, so I guess something is not working with the filter:

CASE WHEN “VBAP”.“MATNR” IN (‘EDIDUMMY’, ‘ILODUMMY’) THEN FILTER 1=1 ELSE
FILTER ISNULL(“VBAP”.“ABGRU”) = 1;

thanks
Masha

Hi Masha,

the following statement should do the trick:

FILTER “VBAP”.“MATNR” IN (‘EDIDUMMY’, ‘ILODUMMY’) OR (“VBAP”.“MATNR” NOT IN (‘EDIDUMMY’, ‘ILODUMMY’) AND ISNULL(“VBAP”.“ABGRU”) = 1 );

FILTER Statements allow logical ORs, so that you do an “either-or” style filter expression.

The parenthesis around the part after “OR” are necessary to make sure that both the MATNR and the ABGRU expressions must be true to yield true for the whole OR part.

Hope that helps

Max

1 Like

Cool, thank you so much, it worked!!!