Wednesday, 27 February 2013

EDI Batching using Biztalk Server 2010



This document describes how to batch multiple EDI document into single interchange EDI.

EDI Batching in Biztalk is done using Batching orchestration(Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService) that is shipped with Biztalk. This batching orchestration is directly binded with MessageBox and picks up message with EDI.ToBeBatched=True. This flag is set when the message is received using edi receive pipeline. There is a component called "BatchMarker" in the receive pipeline that promotes and sets "EDI.ToBeBatched=True".

 Example of Interchange with multiple EDI 840 Transaction.















1: Create Receive Pipeline “EDIBatchMarkPipeline” which will mark edi document for EDI Batch.
  •  Create receive pipeline
  • Add EDI Disassembler, add Batch Marker component.

2: Create receive port “EDIBatchMarkPortFor840”and receive location with EDIBatchMarkPipeline.
Example of EDI 840 with single transaction for batching.

ISA*00*          *00*          *ZZ*US             *ZZ*THEM           *130227*0057*U*00401*000000020*0*T*:~
GS*RQ*BTS-SENDER*RECEIVE-APP*130227*0057*20*T*00401~
ST*840*0020~
BQT*00*BQT02*20111204*001*20120103~
PER*1A*Firstname1**Lastname1~
N1*01~
N2*C01~
N3*Line11*Line21~
N4*City1*WA*112*US~
PO1**1**1***1~
SE*9*0020~
GE*1*20~
IEA*1*000000020~

3: Create Batch configuration for batching.

4: Create two parties: ThemPartyFor840, UsPartyFor840

5: Create agreement for two parties name Agreement1.

6: Create identifier settings.















7: Create batch configuration for UsPartyFor840à ThemPartyFor840


 













Filter Expression
BTS.ReceivePortName = EDIBatchMarkPortFor840
BTS.MessageType= http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_840

8: Click on start batch, after click on start batch, Orchestration (Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService) Instance is created in admin console.



When you click on start button in batch configuration, an entry has been created in PAM_Control table
NOTE : BatchingService orchestration monitor PAM_Control table using sql adapter, as entry comes into table , instance of orchestration start to pick EDI  message whose EDI.tobeBatched context property is true.


9: Create Send port with Filter Expression:
EDI.ToBeBatched == False And
EDI.BatchName == Batch1

10: Start Receiveport , sendport and batch,

11: drop multiple EDI 840 to receive location, check output location.

Tuesday, 26 February 2013

Process EDI 850 using Biztalk 2010



1: Create Biztalk Project Company.Biztalk.EDI850.

2: Copy Schema “X12_00401_850.xsd” from location “C:\Program Files\Microsoft BizTalk Server 2010\XSD_Schema\EDI\MicrosoftEdiXSDTemplates\X12\00401” to Biztalk Project

3: Create PO FlatFile Schema.






4 : Sample for Create Flat File Schema is :
PO1999-10-20
US        Alice Smith         123 Maple Street    Mill Valley    CA 90952
US        Robert Smith        8 Oak Avenue        Old Town       PA 95819
Hurry, my lawn is going wild!
ITEMS,ITEM872-AA|Lawnmower|1|148.95|Confirm this is electric,ITEM926-AA|Baby Monitor|1|39.98|Confirm this is electric|1999-05-21

5: Create Map for Convert EDI850 to PO Flat File.
















6: Create Orchestration.


















7 Expression to identify party configuration are
NOTE : Add reference of Microsoft.BizTalk.Edi.BaseArtifacts

System.Diagnostics.Trace.WriteLine("EDI.AgreementName:"+MsgEDI850(EDI.AgreementName));
System.Diagnostics.Trace.WriteLine("EDI.ReceiverPartyName:"+MsgEDI850(EDI.ReceiverPartyName));
System.Diagnostics.Trace.WriteLine("EDI.SenderPartyName:"+MsgEDI850(EDI.SenderPartyName));

8: Refer article for configure party .

The sample code is available for download in Code Gallery:.