Showing results for 
Search instead for 
Did you mean: 

Xpath-String Function for Interface determination

Former Member
0 Kudos

Hi All,

My requirement is to find the number of records in the field CSVData and compare it with value in the field 'RecordCount'.We want to use xpath functions in Interface determination to do the same.

The source structure is as follows:


The entire data is coming in the field 'CSVData' which will contain multiple records separated by new line.

eg:CSVData contains:



Tried with:



This is not working.

It is confirmed that string functions work as I've tried string-length.

Problems could be either:

1.The syntax is incorrect

2.Combination of string functions cannot be used

3.tokenize and count connot be used in PI.We tried some other combinations like count(Index-of(CSVData)).It didn't work.

4.Any other ?

Already referred the below blog and few other threads on sdn


Can this requirement be achieved with Xpath functions?If yes, please help with the syntax for it.

That will be real help!



Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Couple of thoughts...

AFAIK, tokenize() function is an XPATH extension available in XSLT..

1. Check which version of XML toolkit PI is using.. SAP XML toolkit/JDK 5 XML toolkit? also check XSLT 2.0 version is supported?

See the links given below for more info..

[SAP Help - Replacement of SAP XML Toolkit by JDK 5|]

[SAP Help - Enhancement mechanism of the XSL transformation|]

2. You can try a workaround: Check the counts in mapping and based on the outcome either generate target XML or raise an User defined exception to stop the message flow.

Thanks & Regards,


Former Member
0 Kudos


One solution could be using the BPM as a service.

You need to create 2 Receiver Determinations. The first RD will be between Source System & BPM as target System.

The design will require additional message interface & interface mapping for BPM.

Basically there will be 2 inteface mappings & 2 Receiver Determination and rest of the objects accordingly.

So in BPM just use receive & send step and send the same data with CSVData count after mapping to XI.... and then do your second Receiver Determination by using BPM as source service and use your X-path conditions here..

If you need further info or steps just let me know.



Active Contributor
0 Kudos

Have you tested the XPATH with an external program?

> fn:tokenize(string,pattern)

> Example: tokenize("XPath is fun", "\s+")

> Result: ("XPath", "is", "fun")

maybe "\n" does not work as desired?

Active Contributor
0 Kudos

I suggest avoiding xpath determination in this case.

its better to design your scenario using other alternatives.

Active Contributor
0 Kudos

Hi Manjusha,

You are reading a csv file and converting it to this structure?











Can you check the payload of the inbound message and see whether you received the required structure . If possible paste teh same here for a better understanding



Former Member
0 Kudos

Thanks for the response.


Not reading a CSV File.It is a HTTP sender.

Sample Payload:

<?xml version="1.0"?>

<MT_Segment xmlns:ns1="">















Why do you think we should avoid Xpath functions here?

Active Contributor
0 Kudos

Hi Manjusha,

Count function should be passed with nodename as input, how ever in your case the single string is been split @ newline and passed as an input, thus it will not help you...

To my understanding Count returns no. of time a node occurs accepting a nodename or a path and not how may string are there in a array of string.

if you can repeat node <CSVData> for every new line and then use the fn:count like below

count(Records/Record/AddressDetails/HouseAddressDetails/CSVData) will return the count of the node CSVData and you can compare this with RecordCount value..