SAP PI- B2B ANSIX12 Inbound Scenario
EDI ANSIX12 Inbound
This is an inbound scenario where data flow is as follows. Let’s take EDI 850(Orders) in our example.
External Partner——–EDI 850 File—–(1)—->PI————-IDOC——–(2)——>ECC
External Partner<——–997 Ack——(3)——PI
External partner sends an EDI 850 file to PI. PI converts it in to an IDOC and sends it to ECC. And also PI sends a 997 EDI file back to External partner as an acknowledgement.
There are several ANSIX12 EDI transactions like 810(Invoice), 850(Orders), 856(Shipment) etc. But in our example we talk about 850(Orders).
- Firstly we need to on-board all partners involved, in to PI TPM. TPM stands for Trading Partner Management which is a B2B central repository to maintain all partner information.
2. We’ll on-board following 3 partners in to TPM.
3. Along with these 3 partners we on-board one more partner which acts as self-partner.
4. Before we on-board partners in TPM, we need to create corresponding parties in ID.
5. Above all, make sure B2B add on is installed in our PI landscape.
Things to do in TPM
Step 1: Create all parties in ID
In our example, we have 4 parties to create.
Step 2: Create all Partners in TPM
To create partners in TPM, we first login in to B2B integration cockpit using following URL.
Postfix b2bic to PI url to login in to integration cockpit, which looks like following
Click on Trading Partner Management and add our partners there.
In Party Name select its corresponding party which we have already created in ID in step 1.
Now go to identities tab and give a unique partner ID and partner ID qualifier for the partner and save it.
Here, we give partner ID in identifier text box and ID qualifier in agency code text box. In this case partner ID is 000000000A and Qualifier is ZZ.
Now go to Messages tab, add message type ANSIX12 850 of version 4010 and save it.
Now go to EDI Acknowledgments tab, then go to ANSIX12 tab, mark 997 acknowledgment as required and save it.
Similarly create partners for Partner_B, Partner_C and Partner_ECC as well.
Use partner IDs as 000000000B, 000000000C, 0000000ECC respectively. And use ZZ as qualifier for all partners.
While creating Partner_ECC, select partner type as self.
Step 3: Create Agreements
Now we create partner agreements for all partners. Agreement is created between External-partner and self-partner we created. In our example since we have 3 partners, we create 3 agreements.
To create an agreement for partner A, select it and go to Agreements tab and click on Create.
Similarly create agreements for Partner_B and Partner_C too.
Things to do in ID
In ID, we create 3 ICOs. Below is the reason why we do that.
To achieve our functionality, we have to do following 2 things.
- Send EDI file from external partner to ECC
- Send a 997 acknowledgment back to partner
So, technically it looks like 2 ICO’s are enough here. But as a part of first step (where we send EDI file from partner to ECC), we don’t send it directly to ECC. But we split this in to 2 flows. First flow is from external partner to EDISeparator channel. And second flow is from EDISeparator channel to ECC. The reason why we do this is, we need EDISeparator channel to split incoming EDI message in to multiple EDI messages if contains multiple transactions in it. And also EDISeparator channel is needed to send a 997 acknowledgment back to partner.
Hence we need to create following 3 ICOs in ID.
External Partner——EDI 850 File——>PI———- EDI 850 File ———>EDISeparator
EDISeparator——EDI 850 XML File——–>PI———- IDOC XML ———>ECC
EDISeparator——EDI 997 File——–>PI———- EDI 997 File——->External Partner
I have created 2 Business components, one for external partner and other for EDISeparator. Besides, I have one more business system for ECC.
Note: For simplicity, I have used a file channel to pick EDI messages instead of using AS2.
Creating ICO 1
In ICO 1, sender component would be external partner component and receiver component would be EDISeparator component.
While creating this ICO, give some dummy name for Interface and Namespace. This interface and namespace need not be present in Integration Repository.
Give sender channel as NFS/FTP file channel (for simplicity, I have used file sender channel instead of AS2 sender channel). We will place our EDI files in this path.
In file sender channel modules tab, give following module sequence.
TPMContentAccessModule is required to dynamically fetch partner information from TPM based on sender partner ID, qual and receiver partner ID, Qual combination when ICO gets a new EDI file.
EDISearchParametersModule adds few EDI search parameters like correlation ID which will be helpful while monitoring EDI messages.
In Receiver tab, give business component we created for EDISeparator as receiver communication component. In this case, it is BC_Split_conv.
In Receiver Interfaces tab, give some dummy names for Name and Namespace. They need not be present in Integration Repository.
In outbound Processing tab, give EDISeparator receiver channel which receives incoming EDI file.
In EDISeparator receiver channel, check Read from Dynamic Headers check box. This ensures TPM configuration we did will be given priority to configuration we do in this channel. For example if we say Ack is not required in communication channel and Ack is required in TPM configuration, TPM configuration will be given priority and Ack will be sent.
Now, EDISeparator receiver channel does two things.
- If incoming EDI message has multiple messages in it, EDISeparator receiver adapter will split that EDI message in to multiple individual EDI messages. If it contains only single EDI message, it will just send out single EDI file as it is.
- If the partner is configured as acknowledgment required in TPM, EDISeparator adapter will create another EDI message with 997 transaction as an acknowledgment.
Creating ICO 2
Now, we create ICO 2 to receive splitted EDI messages which is explained in point 1.
So, sender component would be EDISeparator business component and receiver component would be ECC.
In this ICO, give some dummy Interface and Namespace name. They need not be in Integration Repository.
In EDISeparator sender channel do following configuration. Since this ICO should pick up splitted EDI 850 messages, we configure channel as following so that this channel will pick up only EDI 850 splitted messages and ignore the rest.
Incoming message is in raw EDI format. First we have to convert this EDI file in to XML file. Hence we use a predefined SAP module to do that.
Go to Modules tab and configure following module sequence.
TPMContentAccessModule and EDISearchParametersModule are optional. X12ConvertedModule is required to convert ANSIX12 EDI file to XML file. tpm.enable parameter ensures to use TPM configuration while conversion.
Now go to Receivers tab and give receiver as ECC.
Now go to Receiver Interfaces tab and give message mapping which we have created to convert EDI XML to IDOC XML.
I have already created a mapping which converts EDI XML to IDOC XML in Integration repository. I am not covering that in this document. There is an SAP provided mapping for EDI 850. You can refer that to create your own mapping or just use that same mapping in this ICO.
Now, go to outbound processing tab and give IDOC receiver channel.
Creating ICO 3
Now, we need to create ICO 3 to receive splitted 997 EDI message and send it as an acknowledgment back to partner.
Here since no message mapping is involved, we just route the EDI file to partner and no XML conversion is required.
Give some dummy name to Interface and Namespace. They need not be there in Integration Repository.
Create an EDISeparator sender channel to pick up EDI 997 messages and use it here.
Receiver will be External partner here.
Give some dummy names for Interface and Namespace.
In outbound processing, configure one NFS file receiver channel to place 997 EDI files. (In real time, we use AS2 adapter and route the 997 files to partner).
That’s it! We are done with configuring. Below picture gives an overall view on how EDI inbound interface works. In real-time we use AS2 adapter to connect to external partner instead of file channel in our example.
To test the interface end to end, take a sample EDI ANSIX12 850 file and change sender ID, Qualifier and receiver ID, Qualifier so that they will match with our partner configuration.
For example, if we are testing with Partner A, following should be configured.
Sender Partner ID: 000000000A
Sender Partner ID Qualifier: ZZ
Receiver Partner ID: 0000000ECC
Receiver Partner ID Qualifier: ZZ
While testing you will be able to see in message log that sender and receiver partner information is fetched dynamically using TPMContentAccessModule based on partner ID and qualifier combination in incoming EDI file.