cancel
Showing results for 
Search instead for 
Did you mean: 

Condition in Receiver Determination

Former Member
0 Kudos

Dear all

I have SAP PI 7.1

I am facing problem in Receiver Determination while using Condition to select receiver based on the values in the payload.

I need to acheive:

IF

/payload/field1 = "A" then Receiver A

IF

/payload/field2 = 2 then Receiver B

I have Standard receiver determination.

I do not know how to set Condition (under Local Rule) to compare String and Integer values with elements in the payload.

Can someone please advise?

thanks

Alkesh

Accepted Solutions (0)

Answers (3)

Answers (3)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

Hi,

create this routing rule

/payload/field1 = 'A' -->System A

Add a new routing Rule --> Icon [ ]

/payload/field1 = 2 ---> System B

Take in count that the string values must be defined with single quotes ' '

Thanks

Rodrigo P.

Edited by: Rodrigo Alejandro Pertierra on Jun 24, 2010 12:42 PM

Former Member
0 Kudos

Hi

It does not work with single or double quotes.

The Trace shows following:

<Trace level="2" type="T">......extracting (new) for Extractor: XP /p1:SomeInterface/BGR00/MANDT </Trace> <Trace level="2" type="T">......extracting values found: 0 </Trace> <Trace level="2" type="T">......extracting values found: 0 </Trace> <Trace level="2" type="T">...invalid Receiver

There is something not right with the string comparisions for sure because when compare the payload field with not NULL, the comparision result is positive, receiver it determined.

Please suggest.

thanks

Alkesh

Former Member
0 Kudos

Hi Alkesh,

It seems the message interface you are using and the xpath message are not same. In your source payload I see:

<?xml version="1.0" encoding="utf-8" ?>

<ns:MsgInterfaceName_Out xmlns:ns="urn:somens.com">

<MsgInterfaceName>

<BGR00>

<STYPE>0</STYPE>

<GROUP>123 ABC</GROUP>

<MANDT>001</MANDT>

<USNAM>FI_BATCHUSER</USNAM>

<START />

<XKEEP>/</XKEEP>

<NODATA>/</NODATA>

</BGR00>

</MsgInterfaceName>

</ns:MsgInterfaceName_Out>

But your trace says the xpath as /p1:SomeInterface/BGR00/MANDT. So something is wrong here. Indeed your xpath should be like this: MsgInterfaceName/BGR00/MANDT

So select the source field it should be like above and = "001". Put double quotes. It should work

Check this out. Something fussy here. Take a look at both of them.

Regards,

---Satish

Former Member
0 Kudos

Hi Satish

I had to rename some items but I assure correct components are used.

I am configuring the receiver thru lookup and not entering manually, so config is correct.

And the double quotes are not working.

I am also surprised with this behaviour.

thanks

stefan_grube
Active Contributor
0 Kudos

No, quotes are not working.

Maybe you try:

Left side: //MANDT

right side: 001

Or define a context object for the interface.

Former Member
0 Kudos

Stefan

Many thanks for the inputs, it worked (manually putting //MANDT = 001).

What is the reason it did not work when picked up using lookup (F4)?

Help appreciated.

thanks

Alkesh

Former Member
0 Kudos

Hi,

In receiver determination,under TYPES OF RECEIVER DETERMINATION,there is a table called as Configured Receivers.

Add a condition to that table by selecting from the populated window that you will see after clicking on CONDITION column.

There you can give the value of Left operand as

/payload/field1

and on the right operand give the value as

"A".

Close the pop up,now you have to give the value of SERVICE i.e. the receiver

Receiver A

Similarly do it for /payload/field2 = 2 then Receiver B.

SAVE & ACTIVATE the receiver determination.

try n let me know if you faced any issue.

Thanks

Nidhi

Former Member
0 Kudos

Hi

I had tried all that, did not work.

In the payload I can see the value in the element as 001.

I tried the following but non worked:

"=" as Operation, xpath in Left Operand, 001 in Right Operand

"=" as Operation, xpath in Left Operand, '001' in Right Operand

"=" as Operation, xpath in Left Operand, "001" in Right Operand

"=" as Operation, xpath in Left Operand, \"001\" in Right Operand

"EX" as Operation, xpath as /p1....field == "001"

Any many other java methods like equals(), startsWith(), endsWith() etc in combination with EX as Operation, none worked.

In each case the result is that Receiver not found which shows that the condition is not working.

I could check the field <> NULL and the condition worked.

As I understand, the field holds 001 but I can not compare it with string "001" in the condition.

Any known issues with string comparisions in the Condition?

thanks for responses this far.

rgds

Alkesh

Former Member
0 Kudos

Hi Mevada,

Can you please give the source payload here so that somebody can help you out with condition.

Regards,

---Satish

Former Member
0 Kudos

Hi

Here is the incoming payload.

<?xml version="1.0" encoding="utf-8" ?>

<ns:MsgInterfaceName_Out xmlns:ns="urn:somens.com">

<MsgInterfaceName>

<BGR00>

<STYPE>0</STYPE>

<GROUP>123 ABC</GROUP>

<MANDT>001</MANDT>

<USNAM>FI_BATCHUSER</USNAM>

<START />

<XKEEP>/</XKEEP>

<NODATA>/</NODATA>

</BGR00>

</MsgInterfaceName>

</ns:MsgInterfaceName_Out>

I need to set following condition:

If MANDT = 001 then receiver 1

Please note:

If I take out the condition then the interface completes successfully

thanks

Alkesh

Shabarish_Nair
Active Contributor
0 Kudos

what exactly is the issue?

Ref:

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

/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers