cancel
Showing results for 
Search instead for 
Did you mean: 

Xpath expression substring or contains

Former Member
0 Kudos

Hi ,

I have this inbound source message

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

- <rfc:Z_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

- <TO_DATA>

- <item>

<LINE>000012E3 ABCD 3I 20070911164941</LINE>

</item>

</TO_DATA>

</rfc:Z_RFC>

and two inbound interfaces

condition is , if "ABCD" exists in the LINE field(type string) then the corresponding Interface mapping should execute.

I know the exact location of "ABCD occurence so I can use either contains or substring functions.

I tried /P1:Z_RFC/TO_DATA/item[substring(LINE,X,Y)="ABCD"] EX no right operand

/P1:Z_RFC/TO_DATA/item[substring(LINE,X,Y)]= "ABCD" with right operand

substring((/P1:Z_RFC/TO_DATA/item/LINE),X,Y) = "ABCD"

similarly I tried around with <b>"contains"</b> function too.

but not able to apply exactly, I tried with different options looking at different blogs in SDN.

so how should be the Xpath expression ?

thank you.

Babu

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Arvind,

infact its working in the way that its creating all the record values for the existing of the value 'ABCD' if I give like this

/P1:Z_RFC/TO_DATA/item/LINE[substring(.,x,y)='ABCD'] EX no right operand

FYI-occurences are

TO_DATA 1...1

item 0...unbounded

line 0....1

but what I wanted is I need only output values for the input values which have 'ABCD' in it.

basically I am doing RFC to file scenario in async mode and my RFC has just one field which gives a very huge string value and I am parsing out that string into small chunks(using substring in MM) for my destination values.

any suggestions?

thank you,

Babu

Former Member
0 Kudos

Hi Babu,

could you give more details of ur requirment

Former Member
0 Kudos

I want to have record values for the ones I have 'ABCD' in the input string.

when I use the above condition its giving all values in the target.but i have just one record in the source values which has 'ABCD' ,so I want just that record value in the target but not all.

its giving me all ssource values with above condition.what is the right condition expression?

thank you.

Babu

Former Member
0 Kudos

if u use this case u cud determine a inbound interface only when the condition matches i.e. when the string has value 'ABCD' otherwise system cannot determine interface...

in the interface determination do u have two different interface mappings or two dfferent interfaces one when the condition satisfies and other when the condition doens'tmacth...

Former Member
0 Kudos

yes,

I have two different interface mappings in interface determination.

I have same sender RFC interface(outbound) and two different target interfaces and so why I have two different interface mapping,MMs.

sender and reciever systems are same in both cases.

.................condition1--


interface mapping1--


sender -


|--


|--


Receiver

.................condition2--


interface mapping2--


>>>two dfferent interfaces one when the condition satisfies and other when the condition doens'tmacth...

I know why you are asking this,if we have one interface map and two target interfaces then we need to go for enhanced interface determination.

and need not to be just "substring" or "contains" function ,just any function will do.

so any suggestion about the above scenario in ASCII diagram?

thank you.

Babu

Former Member
0 Kudos

Hi,

i think this is what u can have

left operand

/P1:Z_RFC/TO_DATA/item/LINE[substring(.,x,y)='ABCD']

right operand

yourvalue

the condition being

(/P1:Z_RFC/TO_DATA/item/LINE[substring(.,x,y)='ABCD'] = yourvalue)

could "yourvalue" be any string value or is it a fixed value...

Former Member
0 Kudos

Arvind,

thank you for your suggestion it worked but when we use

left operand

/P1:Z_RFC/TO_DATA/item/LINE[substring(.,x,y)='ABCD'] we don't need right operand,we just need to use EX(exists) ,so I used like

/P1:Z_RFC/TO_DATA/item/LINE[substring(.,x,y)='ABCD'] EX no right operand

and I have been trying with " "(quotations not with ' ' ),so it was failing.

now cool.

thank you.

regards,

Babu

Former Member
0 Kudos

Babu,

Try this...

/P1:ZBC_XI_INTERFACE_RFC/TO_DATA/item/Line =( Content operation...not equal to"=" ) ABCD ...yes you have to compare it with ABCD

This will work...

Nilesh