cancel
Showing results for 
Search instead for 
Did you mean: 

Condition in Receiver Determination to dynamically determine receivers based on conditions

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Experts,

We had a condition where we were determining the receivers based on the incoming message at runtime in the Receiver Determination - Condition link. The condition was based on a field with single occurrence per message. If Condition 1 then Receiver 1 and so on. However, now the field has multiple occurrences, so the unique occurrence of the condition still being there but now it contains multiple different entries as well.

Can this method be still used to determine the Receivers ?

If not, is there any other way apart from writing a UDF ?

Accepted Solutions (0)

Answers (7)

Answers (7)

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Experts,

Any inputs for the issue ?
Please refer the last reply to Hari and Satish for a better clarity of the requirement.

BR, Vivek

zameerf
Contributor
0 Kudos

>>The expected condition is that if Name = ABC and ID = 123 then Recvr 1

or If Name = ABC and ID = 789 then Recvr 2 and so on..

First, if your input payload can have both these combinations together at one go, then the entire payload would be sent to both receivers. In this case, you can go for Extended RD and determine the correct receiver using the mapping program.

If you are sure your input payload will not satisfy both conditions at one go, you can try to manually give the xpath conditions.

You can refer the below blog if not read already.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2006/06/07/customise-your-xpath-expressions-...

added the correct blog link

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Zameer,

Thanks for your reply. My Payload will not have both these conditions at one go but my basic concern is that i have to check the first occurrence of the pair (name, value) of parameter which occurs multiple times.

Based on the first occurrence of Name which if is "ABC" to signify that i will get the right receiver at the corresponding "value" field, i need to take the first occurrence of the "value" field and route it to the correct receiver.

Any thoughts?

gagandeep_batra
Active Contributor
0 Kudos

hi Vivek,

try following. i am not sure.

(/GROUP[NAME="ABC" and ID = "123"][1] EX )

Following link may help you refer the first node.

http://stackoverflow.com/questions/1006283/xpath-select-first-element-with-a-specific-attribute

Regards

Gagan

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Gagan,

Thanks for your reply but the above expression selects the first node where the above condition is satisfied. It doesn't pull up the first node to check if the contents are satisfied.

I tried other alternatives as well but it does not fit. Any other options ?

BR, Vivek

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Gagan,

This works now.

The Condition should have [1] and then the comparison [] .

Thanks

Vivek

Former Member
0 Kudos

Hi Vivek,

Try what hari is suggesting.  It will work for ur requirement.  I have worked with same requirement what you have now.

Regards,

Satish.

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Hari,

Hello Satish,

Thanks for your response. But the condition specified doesn't work in this case.

Just to elaborate the requirement.

Observe the Xpath example below:

<GROUP>

<NAME> ABC </NAME>

<ID> 123 </ID>

<NAME> XYZ </NAME>

<ID> 789 </ID>

.

.

.

</GROUP>

and so on. The expected condition is that if Name = ABC and ID = 123 then Recvr 1

or If Name = ABC and ID = 789 then Recvr 2 and so on..

So ideally, for this case the message should go to Recvr 1.

The Basic concern is how to check the first instance of the Parameter for the Pair of name and value and based on the value in that pair, we need to route the message to the right receiver.

Hope this is clear.

Thanks

Vivek

former_member190624
Active Contributor
0 Kudos

Hi Vivek,

why don't we use condition in receiver determination as below?

(/XPATH/RCVPRN = XXXCLNT001) OR (/XPATH/RCVPRN = XXXCLNT400) OR (/XPATH/RCVPRN = XXXCLNT100)

Regards

Hari.

zameerf
Contributor
0 Kudos

Did you try to enable the multiline check box?

Did that help?

If you check condition for a single field in a single message, i believe multiline option would work.

However if you have multiple fields to be checked in a single message, the best way is to go with Extended Receiver Determination.

You can refer the below wiki to get some idea on Extended RD.

http://wiki.sdn.sap.com/wiki/display/SI/Step+by+Step+guide+to+Explain++Enhanced+Receiver+Determinati...

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Farook,

Thanks for the response.

Where is this multiline check box?

Are you talking about multiple conditions such as OR/AND in the condition editor?

Thanks

Vivek

zameerf
Contributor
0 Kudos

This is found at the bottom in the pop up box when you try to select the specific field from input structure for condition. I guess by default this would be enabled. When your condition has ONLY ONE field to be validated with different values and single receiver, I hope this multiline option would work.

However if you have condition for only one field but multiple receivers, then Standard RD won't work

Ex:

Field1=A or Field1=B or Field1=C--->Receiver1

Field1=D or Field1=E--------------------->Receiver2

In the above case, if your input payload has Field1 two times, Field1=A and again Field1=D, the entire payload would be sent to both Receiver1 and Receiver2. Check if this is applicable in your scenario. If so, I would suggest to go for Extended RD; you can refer the link in my previous post.

Former Member
0 Kudos

Hi,

I don't think is possible in standard XI, use ERD.

Fabio

udo_martens
Active Contributor
0 Kudos

Hi,

you dont need a UDF, you need a Enhanced Receiver Determination. A program what selects the right fields value and finds the receiver. You are free to use Message Mapping, XSL, Java or ABAP.

Regards,

Udo

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Martens,

Thanks for your reply. But can you suggest what condition should be applicable here.

The attribute occurs multiple times.

Thanks

Vivek

udo_martens
Active Contributor
0 Kudos

Hi Vivek,

the attribute occurs multiple time by a certain logic (which you should know). Your program can reflect that logic and select the right value, this might not be possible with a X-Path expression in "simple" condition of Receiver Determination.

Regards,

Udo

Former Member
0 Kudos

Hi,

Let the conditions be as it is in RD and create a mapping for each receiver where u can pass only those records which satify your conditions.

Thanks

Amit Srivastava

vivek_vishal
Advisor
Advisor
0 Kudos

Hi Amit,

Thanks for your reply. But we have to dynamically determine the unique receiver based on the single field that has the same value for multiple occurrences. Now the value in this field is unique to every customer. Hope this explanation is clear.

Can the mapping for every receiver help in this case...? if yes, please let me know how.

Thanks

Vivek