Skip to Content
avatar image
Former Member

XPath: contains()

Hello!

We are using XPath conditions in the interface determinations to select a specific mapping according to the payload:

e.g. execute mapping I if:

/ORDERS05[(IDOC/EDI_DC40/MESCOD="IC") and (IDOC/E1EDK14[QUALF="014"]/ORGID="P475")]

e.g. execute mapping II if:

/ORDERS05[(IDOC/EDI_DC40/MESCOD="IC") and (IDOC/E1EDK14[QUALF="014"]/ORGID!="P475")] and not(contains(/ORDERS05/IDOC/E1EDP01/E1EDP19[QUALF="002"]/IDTNR,"#"))

It works fine for mapping I but if mapping II should be triggered the message fails with: "Unable to find inbound interface".

However, if I test the XPath for the second test IDoc in my XPath test tool it returns TRUE so the XPath should be correct. Could it be that the not() and contains() XPath functions are not supported in XI?

Regards, Tanja

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 30, 2008 at 10:10 AM

    Hi Tanja,

    check this blog:

    /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

    XPATH expresens must return an element or node, not a boolean value.

    Regards

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Stefan!

      > /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

      Thanks, the blog was very helpful:

      "Note : It is not possible to have any operator like 'and', 'or' etc outside the brackets [ ]."

      solved my problem. I just changed the XPath to

      /ORDERS05[IDOC/EDI_DC40/MESCOD="IC" and IDOC/E1EDK14[QUALF="014"]/ORGID!="P475" and IDOC/E1EDK14[QUALF="014"]/ORGID!="P476" and IDOC/E1EDK14[QUALF="014"]/ORGID!="P477" and IDOC/E1EDK14[QUALF="014"]/ORGID!="P478" and not(contains(/IDOC/E1EDP01/E1EDP19[QUALF="002"]/IDTNR,"#"))]
      

      and now the correct interface mapping is executed! 😊

      > XPATH expresens must return an element or node, not a boolean value.

      I'm using the XPath in the interface determination, not in the receiver determination. The XPath needs to return TRUE for the interface mapping that needs to be executed. It works as long as you make sure only ONE of the XPaths returns TRUE.

      PS: We will meet again at SAP shortly, I have accepted an offer as XI architect in SAP's internal IT starting from April.

      Regards, Tanja

  • avatar image
    Former Member
    Jan 30, 2008 at 10:19 AM

    Hi,

    You are right you can not use not() and contains() with XI.

    Here you have to use EX operator for existance operator purpose.

    For e.g.

    (/FlightBookingOrderConfirmation [BookingID/BookingNumber > 0100] EX)

    Please refer below link--see the last paragraphs

    http://help.sap.com/saphelp_nw04/helpdata/en/ab/13bf7191e73a4fb3560e767a2525fd/frameset.htm

    thanks

    Swarup

    Edited by: Swarup Sawant on Jan 30, 2008 11:21 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello!

      > You are right you can not use not() and contains() with XI.

      It is possible, see /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

      "Similarly we could use various such XPATH functions like compare(), substring(), string-length() etc according to the needs of design."

      Regards, Tanja