Batching in EDI is one the confusing topics that I saw. I hope this post will help you understand many of the features of Batching.
Please note that – one of the main reasons (that I felt personally) for the confusion is the difference in how it is implemented in different versions on BizTalk. Trading partner management is greatly refined in BTS 2010. Referring to a wrong version blog/description will lead a great confusion.
This post will work only for BTS 2010. For BTS 2009, you may have to promote different fields. Please be noted of this.
What is Outbound Batching?
General structure of an EDI File looks like this.
• It is not possible to use batch EDI schemas for outbound EDI batch.
• EDI map can be used for generating only one Transaction within an interchange
• EDI batch can be generated by using a built in Orchestration Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService available in BizTalk EDI Application (admin console)
• EDI batching can also be done using a Custom way. But we may fail to add proper values for control number or these control number have to be remembered in a Custom way.
Before you continue to the next part of the article:
You have to read / practice the below link. These are very helpful.
How Batching Works:
1. Batching of EDI messages can be configured within an Agreement inside a Party.
2. While configuration a Batch, there are four options available that determine, at which stage a batched EDI messages should be sent to the destination (released). These are
• Schedule – A Batch EDI message will be released (sent to the destination) for every regular intervals.
• Maximum number of Transaction Sets – A Batch EDI message will be released for every fixed number of transactions (ST-SE)/ groups (GS-GE) within an interchange. (For example, a batch will be released whenever 3 ST-SE transactions are available.
• Maximum number of characters in an interchange – released based on the number of characters
• External release trigger – In this a batched EDI message will be sent whenever a trigger message is given to BizTalk.
The below links provides you complete example of different options available with Batching.
Thanks to the owner of the above articles who explained them very clearly.
More on External release trigger:
If you go through the above link #4, the author used External release trigger and drops them in a folder.
And also, the complete EDI file (text file which includes the ISA-IEA segments that get added in EDI Send Pipeline by the Party), will be dropped to the message box.
However, in reality, we have to automate this using an Orchestration. In this case, we are not required to drop the complete EDI file Rather, we can promote some properties to the resultant message of the EDI Map (which will not have GE-GS, ISA-IEA segments) and can initiate batching.
For example, we receive a Flat File having multiple PO’s. We may have to batch them and send in one single Interchange. To create this kind of solution, follow the below approach:
1. Have an orchestration that receives the batch file.
2. Split the file and take each message in a Loop.
3. Map the individual Purchase Order to EDI PO (850) schema.
4. Promote the below properties for the resultant PO schema. (These are applicable for BTS 2010. For BTS 2009, there will be different property)
EDI.BatchId=1; (Batch Id can be seen, once you configure a batch in a Party in Admin Console)
5. Use direct binding and send each of these messages to Message Box.
6. Once all the debatched PO files are mapped to EDI schema and sent to message box, create a Trigger XML in the below format.
(You can copy from the above link #4)
7. Send the Trigger file to a Folder.
8. Create a Receive port and subscribe to the Trigger File you sent, using the BatchControlMessageRecvPipeline Pipeline.
9. Create a Send Port with the Following Filters.
EDI.DestinationPartyName = “Part_Receiver”
EDI.ToBeBatched = False
EDI.BatchName = “Batch850”
That’s it. You are done. You will get the batched EDI file at the send port location.