B2B- EDI Inbound -Step by Step Configuration
I believe readers of this blog aware of new B2B Add-on for SAP PI through available content on B2B integration space. Those who are not aware, it’s new offering by SAP for B2B integration in SAP PI space.
In this blog I’ll discuss step by step configuration in inbound EDI (EDI from Partner) scenario.
Scenario: Inbound EDI (EDI from Partner)
In this example scenario I have configured file sender to pick EDI Message, instead of AS2 Sender or some other technical adapter. Receiver side, instead of IDoc receiver I am storing IDoc in XML format in file system.
Incoming EDI message comprises of following EDI message of ANSI X12 Message format.
810: Invoice 850: Orders
Message format: ANSI X12 Message format: ANSI X12
Version: 4010 Version: 4010
To maintain the focus on Configuration using new B2B adapters, I am not going into details of ESR objects here.
Step 1. EDI message comprising multiple business transactions received in SAP PI by available technical adapters.
Step 2. Receiver EDI Separator Adapter split received message into individual business transaction message.
Step 3. Individual messages then mapped to target messages in SAP PI.
Step 4. Acknowledgement generated and sent back to sender of EDI message [Only available in case of ANSI X12 messages now].
Step 5. Transformed message then sent to receiver using available technical adapters.
To configure this scenario we have to configure two types of Interfaces.
Interface 1: From EDI Sender to EDI separator adapter [Step 1 and 2 above]
- Deliver the incoming EDI message [Comprises multiple business transaction] to EDI separator adapter.
- Split EDI message [Comprises multiple business transaction] into individual business transaction message.
- No need to create any service interface in ESR. Use dummy interface.
- No EDI to EDI XML conversion in this interface.
- No mapping.
Interface 2: From EDI Receiver to backend system [Steps 3 and 5 above]
- Process individual messages separated in interface 1.
- Interface needs to be configured for each individual message and for each pair of sender and receiver.
- EDI message converted in EDI XML format.
- EDI XML message transformed to target message.
Interface 1 Configuration:
File Sender Communication Channel:
I’ll describe the reason to keep file name as ‘*ANSI*.*’ later in the blog.
No mapping in this interface.
EDISeparator Receiver communication channel:
Message Protocol is ANSI X12, since in example inbound EDI message contains ANSI X12 messages.
After processed through Separator interface EDI message split into individual EDI message. Here in our example incoming EDI message splitting into two messages – 810 and 850.
Once message separated, adapter start searching sender communication channel for the particular business transaction and partners. In our example it will search for following sender communication channels
- Transaction 810, Version 4010, Sender ID 1111, Receiver Id 2222
- Transaction 850, Version 4010, Sender ID 3333, Receiver Id 4444
It is required to configure two interfaces to process these messages.
Interface 2 Configuration:
Here I have configured interface only for Transaction 810, Version 4010, Sender ID 1111, and Receiver Id 2222. Similarly it can be configured for other message.
In ESR configure service interface using XSD of transaction 810 and Version 4010.
EDI Separator Sender Communication Channel:
EDISeparator sender Communication channel configured for Transaction 810, Version 4010, Sender ID 1111, and Receiver Id 2222.
Module X12ConverterModule configured in Module parameter of communication channel to convert EDI into EDI XML.
In ESR mapping has to be developed to map EDI XML to Invoice IDoc.
I have not configured IDoc receiver channel, instead I am using file receiver channel to store invoice xml in file system.
In similar way interface can be configured for other separated message. Please find below the screenshot of the EDISeparator communication channel which I have configured in this scenario.
You can see in the above screenshot, first message belong to the interface which split the messages and other two messages belongs to the 810 and 850 message processing.
In real-time scenarios it may possible that same EDI partner sends different formats of messages, say ANSI and EDIFACT. In that case we have to configure separate EDISeprator receiver communication channel in Interface 1 for EDIFACT message Foramt. Route the message based on content [message format] to the different receiver [EDIFACT or ANSI].
Since in interface1 EDI to EDI XML conversion not occurred, so inbound payload remains in raw EDI format [not in EDI XML], so it is not possible to add condition using XPATH in receiver determination. Possible solution from the discussion raised in SDN:
1) Use different communication channels on sender side. They may point to same input folder where you can provide different file names for EDIFACT and ANSI bulk messages respectively.
I have opted this solution in this example for simplicity and to maintain focus on the main objective.
2) Wait for new support package for B2B where SAP planning to provide this enhancement.
I believe from the planned enhancement there will be no need to configure message format in EDISeparator receiver.
a) Write a custom adapter module (to be used on sender side) which can read incoming message and create an XML message with root tag describing the message type (say EDIFACT or something) based on received bulk message. You need to add these XML tags after reading the headers of the incoming EDI messages. Add this custom module to your sender channel.
b) Add two different receivers to the same scenario. And provide condition based on value of XMl Tags you have added during your module development.
c) Now your message is routed in the right manner to the respective EDI Seperator receiver channel. Write another module (or enhance the same adapter module) which can remove these XML tags and convert the payload back to plain EDI bulk message (which you received initially) and use this module in EDI Separator receiver channels.
Thanks for reading !!