xmlxpathsap-pisap-xi

XPATH Expression to determine the receiver in SAP PI


I have a requirement where i need to determine the receiver based on condition in SAP PI XPATH expression. Can someone help please.

except : - when the last segment of the value contains the string “.008” in <Biztransaction> and that the <bizStep> contains the word “commissioning “ - or

when the last segment of the value contains the string “.008” in <Biztransaction> and that the <bizStep> contains the word “receiving “


Solution

  • Strictly speaking, the following XPath should work :

    //bizTransaction[@type="urn:epcglobal:cbv:btt:prodorder"]|//bizTransaction[@type="urn:epcglobal:cbv:btt:resadv"][contains(.,".008")][preceding::bizStep[1][not(contains(text(),"commissioning") or contains(text(),"receiving"))]]
    

    Output : 2 nodes

    We use | operator to "join" 2 expressions. The first part will select "bizTransaction" element regarding 1 condition ("urn:epcglobal:cbv:btt:prodorder"). The second part will select "bizTransaction" element regarding 3 conditions : "urn:epcglobal:cbv:btt:resadv", ".008" and with "bizStep" element which not contains 2 specific keywords ("commissioning" or "receiving").