cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> Will that be the solution: (//STATUS/STATUS_CODE = 0)?

Yes. Receiver determination is always an existence check.

Former Member
0 Kudos

Hi Stefan,

thanks. So what would be the difference between

(//STATUS/STATUS_CODE = 0)

and

(/STATUS/STATUS_CODE = 0)

The second example is what I get if I directly select the node and element within the tree in the condition editor. In example 1 I addes a "/" in the beginning manually, as I thought that is necessary to read all STATUS nodes in the source file.

Cheers,

CHRIS

former_member208856
Active Contributor
0 Kudos

What you have got directly by using tree, in Second Condition, --> Check the same first, if it is working fine.

Else

Chenge the X-Path given in 1st condition.

stefan_grube
Active Contributor
0 Kudos

> thanks. So what would be the difference between

http://w3schools.com/xpath/xpath_syntax.asp

> as I thought that is necessary to read all STATUS nodes in the source file.

No, this is not the reason for using // instead of /

Former Member
0 Kudos

Hi,

I have created some test messages. It is not working as described.

- If there is just one STATUS_CODE element with 0, the correct receiver is determined

- If there is just one STATUS_CODE with anything but 0, the correct receiver is determined

- If there are two STATUS_CODE elements (one with 0, one with 1), the result is the same as if there are are just STATUS_CODE elements without 0

What might be the problem here?

Thanks,

CHRIS

Former Member
0 Kudos

Hi Chris,

Refer the blog suggested by me...

Former Member
0 Kudos

Hi again,

I think I found the problem.

Basically, I am not checking if the STATUS_CODE = 0 (0 means error), but if the STATUS_CODE != 1 (1 means success).

When I change the rec. determination to check if the STATUS_CODE = 0, it works fine e.g. if there is ANY STATUS_CODE with 0.

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?

CHRIS

Former Member
0 Kudos

Hi Hareenkumar,

I had a look at this blog - but that is not really what I am looking for It is about Multiple Receivers and it is a very complicated solution for my very very small, standard requirement.

CHRIS

stefan_grube
Active Contributor
0 Kudos

> 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

Former Member
0 Kudos

Refer the below blog: This may help u.......

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

Regards,

Former Member
0 Kudos

Stefan,

Yes this explanation seems to be the reason for this. However, IMHO, the SAP documentation could be better

Thanks to all.

CHRIS

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Christoph,

Refer the below link:

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

Thanks,