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).
Prerequisites
- 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.
- Partner_A
- Partner_B
- Partner_C
3. Along with these 3 partners we on-board one more partner which acts as self-partner.
- Partner_ECC
4. Before we on-board partners in TPM, we need to create corresponding parties in ID.
- Party_A
- Party_B
- Party_C
- Party_ECC
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.
a. A-ECC
b. B-ECC
c. C-ECC
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.
ICO 1
External Partner——EDI 850 File——>PI———- EDI 850 File ———>EDISeparator
ICO 2
EDISeparator——EDI 850 XML File——–>PI———- IDOC XML ———>ECC
ICO 3
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.
- BC_ExtPartner
- BC_Split_conv
- BS_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.
Hi Avinash,
I appreciate your wonderful document,actually I am searching for complete B2B step-by-sptep blog at last I found it.Good work Keep it up!
Thank you!
Bhoopal
Hello,
Check that link:
https://scn.sap.com/docs/DOC-71653
Step by step here
regards,
Roberto.
Looking for EDI outbound scenario
Hi Avinash,
Good work in explaining the inbound B2B scenario in details.
Keep it up. Continue blogging.
regards,
Younus
Well explained and covers lot of areas about B2B ANSI integration. Thanks for sharing Avinash.
Thanks Avinash for sharing the blog.
Very useful blog Avinash, keep going.
Very useful information.. Thanks...
Hi Avinash,
I was trying to replicate the above scenario. All configuration works fine, apart from "Read from Dynamic Headers" in the EDISeperator Receiver channel. As soon as I enable this check I start getting below error.
"Transmitting the message to endpoint <local> using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: javax.resource.ResourceException: com.sap.aii.adapter.ediseparator.ra.property.handler.PropertyHandlerException: Unable to get property: ControlKey from CPA cacheControlKey"
Do you have any pointers to fix this issue ?
We are on SP04 latest patch for B2B addon.
Regards
Vishal J
Hi Vishal,
When you check the checkbox “Read from Dynamic Headers”, settings are dynamically read from
TPM instead of channel.
Usually we get this kind of exception if modules are wrongly configured in the channels. Please check your module sequence used. Kindly refer module configuration in channel screenshots I showed above.
Thanks,
Avinash B
Hi Vishal,
Were you able to solve your error?
Please can you tell us how you rectified the error.
Thank you,
Bala
Yes Bala, I was missing the TPMContentAccessModule in the file sender communication channel.
Once I added that, the issue was resolved.
Regards
vj
Thanks, Vishal. 🙂
Regards,
Bala
Hi Avinash
i have some doubt regarding “Read from Dynamic Headers” actually how it will work.
based on your previous post as per my understanding is if we select “Read from Dynamic Headers” it will generate 997 based on TPM configurations. am i correct??
once we configure the “Read from Dynamic Headers” option in general tab in Receiver Ediseparator side then no need to config next tab”ANSIX12″ in receiver edi separator “997 ACK Required” option ??
Even if we select both options (“Read from Dynamic Headers” and ” 997 ack required “) what will be happen is it work?? which case we have to use “Read from Dynamic Headers” option .
if we not configure TPM configuration then it will not work “Read from Dynamic Headers” option??
One more doubt is you configured three partys A,B,C in ID level but you didnt use while create in BUSINESS COMPONENT LEVEL and Communication level .than what is the use for creating party in ID level. And how we create link TPM config details in ID level .using this module been localjbs/TPMContentAccessModule it will create link TPM to ID.
Thanks
Kavitha
Kavitha,
When you select both in channel and mention Dynamic , the high Priority is given to dynamic so it will read configuration from TPM.
if we not configure TPM configuration then it will not work “Read from Dynamic Headers” option??
No you will get an error.
Using this module been localjbs/TPMContentAccessModule it will create link TPM to ID.
Yes you are correct.
The parties name created in TPM is just a name for a customer it need not be same which you use in ID , what is more important is the Identifier you mention in the TPM under that party.
Br,
Manoj
Hi Manoj ,
Thanks for your reply.
I have doubt regarding in party's .
I saw Party's in ID but he didn't use any where in ID level i mean if we configure the party's in ID we will use business system/component and communication channel as well .But i didn't see that configuration .
Thanks
Kavitha
How can I change the GS07 - segment in 997 - for example if a customer is sending "T" in 850 - the 997 should send "T" in GS07. But for us it sends "X" - by default to all customers in 997.
Need help.....
We use SAP PO – B2B for EDI.
We have setup EDI separator channel to send 997 automatically as we receive any inbound documents from any customers.
Question - if 850 document for example – received from customer has value in GS07 – “T” - which is responsible agency code – in this case customer is sending value – ‘T’
But in 997 we send document – has GS07 with value “X” – which seems to be default in all 997 that we send to any customers.
We want to change this to be T or we want to make sure it reads from the document and sends the value customer has sent… is this possible?
Thank you very in advance for your help.
Hi Alpesh,
There's one way of doing it. You might have created an ICO for sending 997 to customer. In that ICO's sender EDISeparator channel, use X12ConverterModule to convert it to XML. Then use an intermediate mapping to change its value to 'T'. In the receiver channel convert the mapping output XML to X12 file again using X12ConverterModule.
Hope this answers your question.
Thanks,
Avinash B
Hi Avinash,
Great blog!
I would like to have small questions: I saw there are Parties created in ID but you did not define BC, CC, ICO, etc. for each party. Instead, used BC, CC, ICO, etc has empty Party.
What is the role of Parties in ID? Did you only use them to fill in TPM?
Best Regards,
Steven Nguyen
Hi.
The blog refers to the module X12ConvertedModule.
It's a typo...
Use localejbs/X12ConverterModule 🙂
Best regards...
Peter
Hi ,
I have created scenario as mentioned above and process EDI file via File channel, it went through and generated 850 IDOC.
But 997 Ack is not triggered even in TPM selected 997 required. Channel itself not triggered.
in B2B Acknowledgement in Monitoring status is showing in process
Could you please help me out.
Regards
Dhyanesh
Hi,
It's so helpful for us to understand the data flow even after all these years.
As a beginner , I have another problem with this——
Is there a software for developer to test sending?
Regards
CC