Customizing XPATH in Receiver Determination

Hello,
I am using this blog to write conditions /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination and accordingly call the receiver (either Receiver_1 or Receiver_2), never to call both the receivers simultaneously
I have a sample source message like:
<?xml version="1.0" encoding="UTF-8"?>
<ConsumerDetails>
   <UserId>91200024:123456</UserId> To check if UserId starts with 91200024: or not
   <Date>20111301161459</Date> To check if length of Date is 14 or not
   <Billing>RC</Billing> To check if Billing has value RC/ SB or not
   <Type>SE</Type> To check if Type has value SE/ CWE or not
</ConsumerDetails>
Accordingly wrote the below conditions:
Receiver_1 (Conditions working fine):
UserId (MiddleOperator --> ContainsPattern) --> 91200024:*
/ConsumerDetails[(string-length(Date)) = "14"] --> EX
/ConsumerDetails[(Billing = "RC") or (Billing = "SB")] --> EX
/ConsumerDetails[(Type = "SE") or (Type = "CWE")] --> EX
Receiver_2 (Conditions not working; except 1st condition):
/ConsumerDetails[not(starts-with(UserId,'91200024:'))] --> EX
/ConsumerDetails[(string-length(Date)) != "14"] --> EX
/ConsumerDetails[(Billing != "RC") or (Billing != "SB")] --> EX
/ConsumerDetails[(Type != "SE") or (Type != "CWE")] --> EX
Only Conditions for Receiver_1 are working fine; those for Receiver_2 are not. Can anybody please provide correct conditions to be written in the Condition Editor?
~Thanks.

Hello,
Have you tried using the condition as mentioned below:
/ConsumerDetails[not((string-length(Date)) = "14")] --> EX
/ConsumerDetails[not((Billing = "RC")) or not( (Billing = "SB"))] --> EX
/ConsumerDetails[not((Type = "SE")) or not((Type = "CWE"))] --> EX
i.e. use not() instead of '!' ??
-Rahul

Similar Messages

  • Reg:Xpath in receiver determination

    Hello,
    My message strcture looks like below.
    Record
    Level1
    item
    field1
    Level2
    item
    field2
    Level3
    item
    field3
    There can be multiple items for each level.
    Here goes my condition.
    I have to send the message to the receiver system "A" only when filed2 value is same across all items under level2 i.e. if there are three items under level2, then field2 should have the same value  across the items.
    Can you please let me know how do we impliment this in the reciver determination step using xpath?
    Regards,
    Rahul

    Rahul,
    Your scenario can be achieved using Enhanced Receiver Determination. Using Xpath in Receiver Determination might become complex for your condition.
    Refer below links for Enhanced Receiver Determination.
    http://help.sap.com/saphelp_nw04/helpdata/en/43/a5f2066340332de10000000a11466f/frameset.htm
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3343
    Regards,
    Geetha

  • Using Xpath in Receiver Determination for greater than 500

    Hi,
    I am trying to use Xpath in the receiver Determination step and I want to check a field which is at item level and comes multiple times(0-unbounded) greater than 500.I tried with different options per SDN blogs,Xpath functions,but still I couldn't able to get what i am trying.I want to process the message when "quantity" is greater than 500,else I want to ignore the message with no errors.
    I gave like this    /p1: /LIST/item[quantity>499]     EX
    item loop is 0-unbounded and I need to check for every quantity.I selected the check box multi line as well.
    I played around different options,but still did not get what I am looking for.
    please suggest in this regard ,how I need to give the expression.
    Thank you,
    Sri

    Hi,
    For validating that the item field is occuring more than 500 times you need to choose the
    2.The exact XPath would be in your case *(/p1: /LIST/itemquantity[499]EX)*
    This means if the 500 th occurance of the item exists then the condition satisfies that is always true for 500 and above occurance of the item.
    Please revert if the suggestion proves to be helpful.
    cheers,
    Abhishek.
    Edited by: Abhishek  Paul on May 6, 2010 10:55 PM
    Edited by: Abhishek  Paul on May 6, 2010 11:02 PM
    Edited by: Abhishek  Paul on May 6, 2010 11:08 PM

  • Idoc structure not displying in XPATH at Receiver Determination..!!! Urgent

    Hi All,
    Doing Idoc to File Scenerio,
    In the receiver determination, I need to select the XPATH from the Idoc structure and by based on the GLN number which is coming in one of the segment, I need to pass to different receivers.
    Problem here is Iam not able to see the Idoc structure in the  XPATH to provide the condition.
    But when doing File to Idoc scenarios, Iam able to see the File structure.
    Any idea why IDoc structure is not displaying over here??
    Its a bit urgent for me..
    Waiting for your replys.
    Thanks&Regards
    Seema.

    Hi,
    This will help you now
    Hi,
    If you get the following msg while selecting the BS in Receiver Determination and if you are unable to view the Structure of the Source
    "Message interface does not exist in any software components installed on this business system"
    1) Open ID-----Double click on Business system that which u are using in the scenario
    2) Check whether you are able to see the SWC in the Othere attributes TAB
    3) If it is not there means goto SLD----Open the Technical System of R/3 by choosing Web as ABAp type
    4) Click on Installed Products TAB
    5) Click on Add New product and add your Product of the SWC whcih you are using for developement and Save it
    6) Then goto Business systems TAB in the same Technical systems window and click on the Business System appears in the window.
    7) Click on Installed products and Check the check box of your Product and then finally save that.
    Now you should be able to see the SWC in the Othere attributes TAB in ID
    Regards
    Seshagiri

  • XPath in receiver determination: Check content of elements that exist 0..n

    Hi all,
    I have a simple requirement in a receiver determination. In the structure of the XML message, there is a node "STATUS" with an element STATUS_CODE. This STATUS node can appear 0 or  9999 times.
    I want to check if there is ANY STATUS with STATUS_CODE = "0", and if so, the message should be sent to a certain receiver. How to to that?
    Will that be the solution: (//STATUS/STATUS_CODE = 0)?
    Thanks,
    CHRIS

    > So it seems to me that the operator != can't be used to check a 1...n element? What might be the reason for this?
    I am not sure how != works, it is not documented well.
    I suppose NE means: does not exist.
    So if any node STATUS_CODE with value 1 exists, then the result is false.
    If you want an existence check if this, you should apply this:
    //STATUS [STATUS_CODE != "1"]  EX
    See also:
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/ab/13bf7191e73a4fb3560e767a2525fd/frameset.htm
    (scroll to the bottom)
    /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

  • XPATH in receiver determination

    Hi,
    We need to dynamically determine the receiver service based on the payload.
    In the extended service editor we have succesfully used a simple XPATH expression to point out a specific field of the payload (just like using af context object) containing the service name.
    However, in most cases the service name is a substring of a field of the payload and furthermore a constant is to be added to give the full service name. We have tried to solve this problem using the XPATH functions 'concat', 'string' and 'substring'. But as soon as we add just the simplest function to the XPATH expression, the receiver determination fails (unable to process the XPATH).
    We have tested the XPATH with the actual message using XML Spy, and it works well.
    The XPATH expression is: "concat('SAPR3_', substring(string(/p1:receipt/p1:identity), 2, 5))"
    Any hints?
    Regards
    Lars

    Hi Lars,
    I just noticed, that you are talking about extended Service Editor - not a Condition - so my answer above is obviously rubbish.
    What remains true is that the XPath you use has to result in a node, than the nodes string is taken as a service.
    So I am afraid there is no easy solution for your problem...
    If you do not have too many receivers and this list is rather static, you could of course use conditions in the receiver determination - something like:
    receiver service = SAPR3_b if /.../ = abc
    but this is of course not really applicable if the list of possible receivers gets too long.
    Another possibility would be to use the substring as a receiver within the configuration. So take it from the payload in the receiver determination and use this 'service' for interface determination and receiver agreement.
    Than, within the receiver agreement you can exchange this name by the 'real' name in the header mapping (which is performed as the very last step in the pipeline). Since you have a receiver agreement per receiver anyway, you would not have to create additional configuration objects. The downfall is of course, that to 'read' the configuration (or the message monitoring) one has to know about this mapping trick...

  • Use of range in case of XPATH for receiver determination.

    Hi Experts,
    I need to achieve the following using standard receiver determination.
    The material number in the source message structure has to lie within a perticular range and that should decide the receiver of the message.
    For example:
    MT_SRC
    |---- Ele1
    |----
    MaterialNo.
    If MaterialNo is between 100000100 and 100001000 then it should be sent to BS_TGT1 else it should be sent to BS_TGT2.
    Is it possible to achieve this using the standard conditional receiver determination using XPATH and if yes, how exactly?
    Regards,
    Amol

    Hi Amol,
    I think its possible. Never tried though for a range.
    Go through this link and check out what is described under the section "Notes Regarding the Use of XPath Expressions"
    http://help.sap.com/saphelp_nw04/helpdata/en/43/a513f2632c332ce10000000a11466f/frameset.htm
    I am not sure whether it will work for two conditions though, i.e. for a range( Greater than 100000100, less than 100001000).
    Just try and let us know.
    Regards,
    Sanjeev.

  • XPATH and Receiver Determination

    In Reference to forum thread : Conditions in  Xpath (Receiver determination)
    Suppose I have MT as
    MT_Pickfile
       |_Header
       |_Body
       |_Trailer
    And i need to check;
    (field3 = "100" or field3 = "200" or field3 = "300" ) and(field5 = "AA" or field5 = "BB" or field5 = "CC")
    field3 is in Header and field5 is in Body
    I tried giving
    /p1:MT_Pickfile/Header[(field3 = "100" or field3 = "200" or field3 = "300" )] and /p1:MT_Pickfile/Body[(field5 = "AA" or field5 = "BB" or field5 = "CC")] EX
    It doesnt work. But then if both field3 and field5 are in Header then it works (as had been the case in the above mentioned thread which Stefan Grube replied to) i.e. to say
    /p1:MT_Pickfile/Header[(field3 = "100" or field3 = "200" or field3 = "300" )] and [(field5 = "AA" or field5 = "BB" or field5 = "CC")] EX
    Can anybody put in their suggestions ?
    Thanx in Advance,
    ShaBZ

    Hi Shabarish,
    It is not possible to have <i>and</i> or <i>or</i> outside the brackets <i>[]</i>.
    Try following:
    /p1:MT_Pickfile[(Header/field3 = "100" or Header/field3 = "200" or Header/field3 = "300" ) and Body/field5 = "AA" or Body/field5 = "BB" or Body/field5 = "CC")]
    Another idea:
    Write two lines in receiver determination (use insert expression):
    1. line:
    /p1:MT_Pickfile/Header[(field3 = "100" or field3 = "200" or field3 = "300" )]
    2. line
    /p1:MT_Pickfile/Body[(field5 = "AA" or field5 = "BB" or field5 = "CC")]
    Hope that helps
    Stefan

  • Conditions using xpath in Receiver determination

    How to write conditions using xpath in receiver determaination. Please provide few examples.
    Regards,
    Suresh.

    hi
    Defining Conditions
    You also have the option of specifying the conditions to be applied when forwarding a message to the receiver(s) in a receiver determination.
    Generally, a condition relates to the contents of a message; if a specified condition is fulfilled for a particular payload element (the corresponding element has a certain value, for example), then the message is forwarded to the specified receiver(s).
    &#9679;     If you want to specify a new condition for forwarding the message to a receiver, in the table in the Display/Edit Receiver Determination editor in the Configured Receivers frame, choose Insert New Condition () and call the condition editor by using the input help ().
    &#9679;     If you want to specify a new condition for forwarding the message to multiple receivers, in the table in the Display/Edit Receiver Determination editor in the Configured Receivers frame, choose Insert Line After Selection ( ) and call the condition editor  by using the input help (). 
    In the condition editor, you can select an element from the message payload and specify a value with which the value of this element is to be compared at runtime.
    check the link below
    http://help.sap.com/saphelp_nw04/helpdata/en/67/49767669963545a071a190b77a9a23/content.htm
    note:reward points if solution found helpfull.....
    regards
    chandrakanth.k

  • Receiver Determination Condition and XPATH

    Hi Everyone,
    I have a receiver determination with conditions and can not figure out why one thing is working, and the other isn't.
    As suggested in the following forum post, XPATH and RECEIVER DETERMINATION, I had to do the following to my XPATH expression to make it work.  The full xpath expression is this:
    (/p1:RenExtract_MT/Detail/CompanyCode = 9740)
    where
    p1 = http://company.com/xi/fin/
    but whenever I put in a condition it could not find a receiver.
    Hoewver, when I did this:
    //CompanyCode
    it worked.
    I did everything through the condition editor, many times, and didn't type anything in myself.  Is there a length limitation or something (I removed some data in here, the expression is really longer!).
    Any ideas?
    Peter

    Hi Peter,
    I do not have an explanation for this wired behaviour.
    But I can assure your, that your working solution, the //something expression is a good one and not inferior to a solution using an explicit, absolute path.
    Why is that: I can remember some benchmarks, where the //something expression always outperformed the other one.
    Regards
    Gregor

  • Receiver Determination error in Xpath

    In   receiver determination step,  I am specifying two condition check.
    The problem is that XI server is checking the second condition ahead of the first condition.
    Eg:
    I have a structure like Record in the input file:
    Record:
       Field1
       Field2
       Field3
    In specifying condition, I have a condition like this:
    If   field1 =  XY AND  field2 = AB
    Then   (do..)
    But the XI server is reading field2 first and not field1 . Why is this so?
    Thanks a lot.
    Shaily

    Check the "AND" condition properly make sure it is not a "OR" condition in xPath.
    Refresh the cache by tcode sxi_cache and try again.

  • XPath Error in Receiver Determination

    Hi All,
    I hav an outbound message coming out of ERP (Non IDoc). I have to route the message based on the field DESTINATION in the message. The payload in the SXMB_MONI is as follows.
    <?xml version="1.0" encoding="utf-8" ?>
    <nr1:OLabelling_OB xmlns:nr1="http://cpe.com/cpe_ftp_wms/Labelling/OL">
    <Label>
      <b><DESTINATION>XXXX</DESTINATION></b>
      <PRPRORD>0001005683</PRPRORD>
    </Label>
    </nr1:OLabelling_OB>
    In the receiver determination, I hav chosen the XPath button and given the following value
    <b>/nr1:OLabelling_OB/Label/DESTINATION</b>.
    This doesn't work. i had also tried giving the namespace and the prefix as
    <b>nr1</b> <b>http://cpe.com/cpe_ftp_wms/Labelling/OL</b>. but that dint help either.
    If i remove the condition, then it is working fine.
    Any help in this regard?
    Thnx in Advance.
    Anil

    I had activated and checked......it was not getting displayed.......
    But i checked the xpath rules and used a work around solution for this. as per the xpath rules if i enter xpath as //DESTINATION, it picks up the DESTINATION field from anywhere in the document. and that worked.
    Thnx for ur help so far...
    anil

  • XPATH condition in receiver determination.. Sum one of the filed

    Hi,
    This is my input payload.
    segment "Record" will be coming multiple times.
    <ns:MT_Account xmlns:ns="urn:com.statement">
    -<BalanceRecs>
      - --<Record>
    <field1>CUA</field1>
    <field2>0.00</field2>
    <field3>324612.28</field3>
    <field4> LTD</field4>
        -----<numRecs>0</numRecs>
    </Record>
      --- <Record>
    <field1>CUb</field1>
    <field2>0.00</field2>
    <field3>324612.28</field3>
      <field4> LTD</field4>
      <numRecs>2</numRecs>
    </Record>
      --- <Record>
    <field1>CUc</field1>
      <field2>0.00</field2>
    <field3>324612.28</field3>
       <field4> LTD</field4>
    <numRecs>0</numRecs>
      </Record>
    </BalanceRecs>
    Requirement:
    I need to calculate the sum of field "numrecs".
    If the sum is 0, then pass to BPM(IP_BPM)
    If the sum is > 0 then pass to System B.
    I tried using the below blog from shabarish..
    /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination
    /p1:MT_ActBalance/BalanceRecs/BalanceRecord[sum(numRecs) = 0] EX        --> BPM
    /p1:MT_ActBalance/BalanceRecs/BalanceRecord[sum(numRecs) > 0] EX        --> SystemB
    Is there anything im missing .. kindly suggest.
    Thanks
    Deepthi.

    Hi Mark,
    It is working only for one receiver.
    i mean
    <numRecs>0</numRecs>
    <numRecs>0</numRecs>
    <numRecs>0</numRecs>
    The message is going correctly when the sum value is 0. ie to BPM.
    <numRecs>0</numRecs>
    <numRecs>2</numRecs>
    <numRecs>0</numRecs>
    OR
    <numRecs>2</numRecs>
    <numRecs>0</numRecs>
    <numRecs>0</numRecs>
    When I pass the above payloads, it is going to both the receivers.
    Since the total is 2, it should go only to systemB
    Any idea?
    This is working perfectly for enhanced receiver determination. I dont want to use enhance version for this simple case.

  • Using substring in the XPATH expression for Receiver Determination

    Hello, I need a little help please.  In my receiver determination, I have a condition and I need to do a "not like" check.   Basically, if the first three positions of the source field does not start with a specific code, then I need to execute the condition.   The condition editor does not support a "not like" operand, so I went to the XPATH expression editor.  I tried to used the XPATH substring function to get the first three characters and then do a "not equal" operand, but it doesn't appear to work.  There are not any runtime errors, but the condition is not executing.  Any ideas on this?  Does the XPATH expression support the substring function?

    Hi Jesse,
    Can you please explain what is the meaning of http:// in the statement
    /p1:PRODUCT/MATNRhttp://not(substring(.,string-length(.) - 2) = '123')
    Please explein, I am having same issue. It is not working here.In My case it is
    /p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,\"D\"))]
    also tried with
    /p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,'D'))]
    Thanks in advance!

  • ** XPath condition not work well in Receiver Determination.

    Hi,
    My scenario is having 3 receivers. I have 'Student' is the data type. I use the same data type for Source & Target Message Types. Requirement is I have to send
    1) only records which are having SCOURSE = 'BE' to receiver 1
    2) only records which are having SCOURSE = 'MCA' to receiver 2
    3) only records which are having SCOURSE = 'MBA' to receiver 3
    My Input.xml file contains the following records.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:THIRD_MT_OB xmlns:ns0="http://ganesh_third">
       <STUDENT_INFO>
          <ST_ID>10020</ST_ID>
          <SNAME>Raja</SNAME>
          <SCOURSE>BE</SCOURSE>
          <SFEES>3000</SFEES>
          <SMARKS>1200</SMARKS>
       </STUDENT_INFO>
       <STUDENT_INFO>
          <ST_ID>10021</ST_ID>
          <SNAME>Ram</SNAME>
          <SCOURSE>MCA</SCOURSE>
          <SFEES>3000</SFEES>
          <SMARKS>1200</SMARKS>
       </STUDENT_INFO>
       <STUDENT_INFO>
          <ST_ID>10022</ST_ID>
          <SNAME>Ram</SNAME>
          <SCOURSE>MBA</SCOURSE>
          <SFEES>3000</SFEES>
          <SMARKS>1200</SMARKS>
       </STUDENT_INFO>
    </ns0:THIRD_MT_OB>
    I set the Xpath condition in the Receiver Determination Step and add the 3 receivers for against the conditions.
    Our problem is, If we send the single record in the input file, the corresponding receiver is selected correctly and we get the output file for that receiver. But, if we send the all combination of records (MCA,BE,MBA) 3 receivers are selected and the 3 output files we get. But, the three files are having the all records (MCA,BE,MBA). Instead, we want the first file should only have MCA record,  the 2nd file should only have BE record and finally the 3rd file should only have MBA record. That means each receiver should receive only one record for the above input.
    Friends, I though it will work for the 'XPath Expression' against receivers in the Receiver Determination Step. But, it didn't work. (Records are not split up)
    How do achieve this, friends?
    Could you kindly help me to solve this problem.
    Kind Regards,
    Jeg P.

    If you are trying to split you input msg and send it  to 3 different receivers using conditional receiver determination then it will not work. Once a condition is meet in the receiver determination then the entire msg is forwarded to the corresponding receiver, that is why when you have a single row in your input file which results in a single msg in XI the conditional receiver works. Now when you have multiple rows in your input file still only one msg is being created in XI for all the rows currently so all the conditions are being meet and the msg is forwarded to all the receivers.
    If you are using FCC in the sender side then use the "recordset per msg" parameter to consider each row of your input file as a separate msg in XI and the rest will automatically fall in place.
    Cheer's

Maybe you are looking for

  • BW Arhiving- Enhancement

    HI all, I am archiving a infocube. i have done with the write phase and deletion phase. Now the data target need to be enhanced. I know some of the enhancement like adding a new characteristic. can u pls give all the enhancement that could be done on

  • My iphone 4s is recognized by itunes and iphoto, but it will not show as a device in finder for macbook pro

    My iPhone 4s is recognized by itunes and iphoto however it does not show up in finder under devices.

  • Dvd drive does not read dvds

    my laptop does not read dvd disks but its able to read some cd disks. what should i do

  • ORA-01403 :no data found in apex

    dear all Please, not to view this thread as the contents are same posted in another thread with a different subject. i have a form with 6 regions. in one of the region i place a button save. i have a conditional process to insert the data in the tabl

  • Facetime missing..

    i just got a new ipod touch 4th gen and i wanted to facetime with my freinds but my touch does not have the facetime app can someone please help me with this problem as i have treind everything such as updating and restoring the touch with no results