Skip to Content
Author's profile photo Konrad Thalheim

EDI Separator XML: Xpath Queries for EDI Separator Sender Channels

Usually I face edifact, eancom, ansi x.12 messages in my edi integration projects. XML message interfaces like OpenTrans appear from time to time. However, these XML message interfaces were always used in a direct integration omitting the SAP b2b addon.

EDI Separator Adapter is able to handle XML messages – and it is able to use Xpath queries, too. 🙂

In this blog I will show you some examples, how to use the edi separator adapter for routing xml messages without large receiver determinations or receiver splits.

Example

Let’s say for example you have the following substructure in our xml message…

<Partner>

     <Partnertype>Buyer</Partnertype>

     <Partner_Id>0000020518</Partner_Id>

</Partner>

<Partner>

     <Partnertype>ShipTo</Partnertype>

     <Partner_Id>0000020519</Partner_Id>

</Partner>

and you would like to route the xml messages according to the specific buyers Partner_Id. An expression like

(/MyXML/Main/Header/Delivery/Partner/Partner_Id = ‘0000020518’) AND (/MyXML/Main/Header/Delivery/Partner/Partnertype = ‘Buyer’)

will not work for you. You need to use

/MyXML/Main/Header/Delivery/Partner[(PartnerType = ‘Buyer’ and Partner_Id = ‘0000020518’)] EX

In the swing tool environment, it looks like this:

In cases you would like to send all messages for this partner – not just one type like delivery messages, but invoices, order responses also, within one listening edi separator sender channel, you can use the following expression:

*/Partner[(PartnerType = ‘Buyer’ and Partner_Id = ‘0000020518’)] EX

Other xpath expressions widely used in SAP PI/PO will work, too.

Prerequisites

The edi separator receiver channel needs an active check box ‘Enable XML’

and secondly, if you have an UTF-8 encoding within your XML files:

Set the following parameters in the Advanced Mode:

edi.recv.input.encoding     UTF-8

This is important to keep your codepage as UTF-8.

Limitations

For large XML files the edi separator sender channels will take quite long for fetching their messages. E.g. in my projects 10 MB large XML files took 3 to  5 seconds to route. A 50 MB large XML file took 20 seconds. It seems that the processing time will grow exponentially depending on size of the XML message and the number of the XML sender channels within the SAP PO system.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Manoj K
      Manoj K

      Thanks Konard ! was not knowing the Message portocol XML was made for this purpose but still when the conditions are complex we have to go for extended Reciever determination as such conditions cannot be handled by EDI_Seperator 🙂

      Author's profile photo Konrad Thalheim
      Konrad Thalheim
      Blog Post Author

      Hi Manoj, in one project we extended the adapter meta data of the edi separator to handle 256 characters in our xpath query. This also works fine. 🙂 Many ways lead to Rome. In my opinion it is good to have many options.

      Author's profile photo Federico Abait
      Federico Abait

      Hello Konrad,

      Can you please refer us the note which you have applied to XPATH query characters.

      Fede

      Author's profile photo Manoj K
      Manoj K

      Hi Federico,

      I dont think there is note for such what Konard meant is to extend the metadata in ESR manually like below :

      123.PNG

      Br,

      Manoj

      Author's profile photo Konrad Thalheim
      Konrad Thalheim
      Blog Post Author

      @Federico Abait: Kindly review Manoj's answer. 🙂 The only disadvantage is, that you need to change the adapter meta data after every update of your SWCV. 😏

      Author's profile photo Federico Abait
      Federico Abait

      Thanks very much!!

      Author's profile photo Federico Abait
      Federico Abait

      Thanks very much