简体   繁体   中英

XPATH expression with negating condition in SAP PI XSLT Mapping

I have to maintain conditions in Interface Determination of ICO in SAP PI. I have several invoice types like L1, S1, G1, F1, etc. I have two separate mappings as per requirement.

When the Invoice type is L1, S1 or G1, and LAND1 = IND, PARW= W and QUALF=015, I want to pick 1st mapping and for remaining invoice types I want to pick 2nd mapping.

The XPath expressions in the Condition Editor for the two mappings are:

1)

(/ZEINV_INVOIC02/IDOC/E1EDKA1[PARVW = 'W' and LAND1 = 'IND'])   EX   AND
(/ZEINV_INVOIC02/IDOC/E1EDK14[QUALF = 015 and ORGID = 'L1'])    EX   OR
(/ZEINV_INVOIC02/IDOC/E1EDKA1[PARVW = 'W' and LAND1 = 'IND'])   EX   AND 
(/ZEINV_INVOIC02/IDOC/E1EDK14[QUALF = 015 and ORGID = 'G1'])    EX   OR 
(/ZEINV_INVOIC02/IDOC/E1EDKA1[PARVW = 'W' and LAND1 = 'IND'])   EX   AND
(/ZEINV_INVOIC02/IDOC/E1EDK14[QUALF = 015 and ORGID = 'S1'])    EX

2) (I have an issue with the second line about ORGID expression)

(/ZEINV_INVOIC02/IDOC/E1EDKA1[PARVW = 'W' and LAND1 = 'IND'])                                    EX AND
(/ZEINV_INVOIC02/IDOC/E1EDK14[QUALF = 015 and ( ORGID ≠ 'L1' or ORGID ≠ 'G1' or ORGID ≠ 'S1' )]) EX

The issue is that when the ICO is run, it is picking both mappings, satisfying both conditions with these values:

ORGID = 'L1'
QALF  = 015
PARW  = 'W' 
LAND1 = 'IND'

What is the XPath expression for the second condition when we have ORGID values other than L1, G1 and S1?

Unfortunately, the expression ORGID ≠ 'L1' or ORGID ≠ 'G1' or ORGID ≠ 'S1' is a tautology , ie it's true if ORGID is 'L1' and true if ORGID is not L1 , so the whole expression is always true whatever the value of ORGID is.

What you want is this:

not( ORGID = 'L1' or ORGID = 'G1' or ORGID = 'S1' )

Note that you may also use the equivalent expression without not , by using the De Morgan's law , here you have to switch and/or and negate the conditions:

ORGID != 'L1' and ORGID != 'G1' and ORGID != 'S1'

NB: does really work? Shouldn't you use != ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM