Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shabarish_Nair
Active Contributor

Recent forum posts on Receiver Determination and XPATH, if you might have noticed have opened up more options for XI developers to ponder on. This weblog will look into some 'enhancements' we can do to the XPATH expressions that we use in the condition editor during Receiver Determination.   Lets first start with one of the recent Re: Conditions in  Xpath (Receiver determination).

To acheive such a condition we could actually go in and change the XPATH expression to what we choose, a special thanks to Stefan Grube who suggested the same. 

Lets explore those options. Say I have a Message Type as shown below;


Take the query in the post. Simulating the same in accordance with the Message Type we have defined, lets say we need to check the following condition in the Header segment; (field1 = "100" OR field1 = "200" OR field1 = "300") AND (field3 = "AA" OR field3 = "BB" OR field3 = "CC") We can go and write our own XPATH expression to acheive the above condition.

Refer the below screenshot;


As suggested by Stefan in the post, we can write a whole XPATH expression in one line and use the EX operator for this purpose. The important thing to consider is the Parent node

In our case the parent node is /p1:MT_Pickfile/Header and moving forward our expression would be  /p1:MT_Pickfile/Header[(field1 = "100" or field1 = "200" or field1 = "300") and (field3 = "AA" or field3 = "BB" or field3 = "CC")]

Note : All the operators would be in lower case. For more details visit this link for a list of XPATH operators. Now in case we have a condition as follows, (field3 = "100" or field3 = "200" or field3 = "300")and (field5 = "AA" or field5 = "BB" or field5 = "CC") where field3 is from Header and field5 is from Body.

Here our expression would be; /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")]Note : It is not possible to have any operator like 'and', 'or' etc outside the brackets [ ]. 

We can even involve XPATH functions in our expression.  Let me illustrate this with an example. Suppose I need to check if the sum of field3 in Body (0 - Unbounded) is greater than 10000 and then route it to a different receiver, we can use the XPATH function sum() in our expression as follows;

/p1:MT_Pickfile/Body[sum(field3) > 10000] and then use the EX operator.

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

On a second thought we could even change the scenario in this XPath to show the path (Multiple Receivers) and pull out the BPM. Well that's for you to try out !!!! 🙂 

Further References:  Weblogs on Receiver Determination / XPATH :


1. XPath to show the path (Multiple Receivers)

2. Illustration of Enhanced Receiver Determination - SP16

3 Comments
Labels in this area