cancel
Showing results for 
Search instead for 
Did you mean: 

XPATH Condition in ICO in SAP PO 7.4

Former Member
0 Kudos

Hi All,

We are on SAP PO 7.4

We have scenario wherein source message has four different structures under it as below;

<root>

<Struct1>

     <A></A>

     <B></B>

</Struct1>

<Struct2>

     <C></C>

     <D></D>

</Struct2>

<Struct3>

     <E></E>

     <F></F>

</Struct3>

<Struct4>

     <G></G>

     <H></H>

</Struct4>

</root>

At a time only one structure will have values. Other three structures will be still present in the message but with empty values. (Only tags will be present.)

We have four different target messages with which we have mapped respective structures from the source message.

So we have 4 message mappings & operation mappings.

Also we have four different receiver channels to which we need to send the respective target message.

So we have to check for existence & values in the specific structure in source message and based on that we need to call respective inbound interface & operation mapping.

How do we handle this in XPath conditions in ICO?

Requesting you to do the needful.

Thanks,

Amit Shantaram Patil

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Amit,

In the receiver interfaces tab on the ICO, add four lines, one for each of your operation mapping.

Then in the condition editor, use the != operator to check for blanks. For the first interface, only check for fields in the Struct1 and so on, see example below

Condition (it is not necessary to include checking Struct2 for operation mapping1)

/Struct1/A != OR /Struct1/B != ----> 1st Operation Mapping

/Struct2/C != OR /Struct2/D !=  ----> 2nd Operation Mapping

/Struct3/E != OR /Struct3/F != -----> 3rd Operation Mapping

/Struct4/G != OR /Struct4/H != -----> 4th Operation Mapping

At runtime, these conditions will get evaluated and the corresponding inbound interfaces will be created.

Regards,

Mark

Former Member
0 Kudos

Hi All,

Thanks for valuable inputs!

We could achieve it using string-length function in XPath conditions under Receiver Interfaces in ICO as shown below.

Thanks,

Amit Shantaram Patil

former_member202642
Participant
0 Kudos

Hi Amit,

Could you please explain this X-Path condition. especially the 'EX' at the end of condition.

I couldn't get it properly.

Regards,

Aamir

Former Member
0 Kudos

Hi Aamir,

I have used the XPath condition ( /p1:HostInquiryReq/getAllReads[string-length(mobileUserID)!=0] ) in the left operand to check whether there exists any value in the mobileUserID field of message structure getAllReads. Based on this, I'm calling respective inbound interface & operation mapping. This I have repeated for three other message structures as well.

I have used operator EX (existence operator) just to check existence of left operator condition by keeping right operator blank. So I have written all my condition in left operator only.

For more info, You can refer below links;

Xpath Condition in Receiver Determination - Process Integration - SCN Wiki

Defining Content-Based Routing - SAP NetWeaver Process Integration - SAP Library

Thanks,

Amit Shantaram Patil

former_member202642
Participant
0 Kudos

Thanks Amit.

It was very helpful.

Answers (1)

Answers (1)

vadimklimov
Active Contributor
0 Kudos

Hi Amit,

You can get use of multi-mapping so that based on one source message, you can produce a target message that corresponds to one of four message types (which means, you assign all for message types as target messages in graphical multi-mapping and set their occurrence to 0...1, so that you can produce only one of them at runtime). Having this in place, you can then define mapping rules for root elements of corresponding target messages that verify if respective source message elements have values assigned to them or if they are empty, and decide if you need to produce corresponding target message or not. In this case, you don't need XPath conditions at all.

Regards,

Vadim

Former Member
0 Kudos

Hi Vadim,

I'll come back on this after trying out what you have suggested and will let you know if I stuck somewhere.

Actually there are four different target XSDs to be mapped with the common source structure. Thes are the four XSDs from a webservice (with four different actions). So we have four different inbound interfaces and receiver channels.

Will the multi-mapping solution still work for this scenario?

Thanks,

Amit Shantaram Patil

former_member186851
Active Contributor
0 Kudos

Hello Amit,

Yes it will work.

Add all the structures in the signature tab of mapping.

And also make sure all the interfaces are added in ICO.

You can keep the below link for reference

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90dcc6f4-0829-2d10-b0b2-c892473f1...