Friday, October 08, 2010

Biztalk 2006 R2 EDI Batching

EDI Batching – How does it work ?, How do we configure EDI application to Batch



Microsoft provides an EDI application to help the batching of EDI files to send that as a group to Trading partners.

The application name is Biztalk EDI Application.

Under above application, an orchestration “Microsoft.BizTalk.Edi.BatchingService” is subscribed against promoted properties EDI. PartyDestinationId, EDI.ToBeBatched, EDI.EncodeType

This orchestration will process all the EDI Message with above three properties promoted and apply the batching logic configured for the trading partner based on the Party Destination ID



Orchestration developer responsibility :

Create an orchestration and promote above propertied in the expression shape. Use edi dll to get the Party destination ID from party name. Following are the code snippet used in the expression :

msgEDI820(EDI.ToBeBatched)=true;

msgEDI820(EDI.DestinationPartyId)=varNet_PartyUtilities.GetPartyIDFromPartyName("tradingPartnerName");

msgEDI820(EDI.EncodingType)=0;



In above code snippet varNet_PartyUtilities is .net serializable class that access edi dll to get the party ID as

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.BizTalk.Edi.PartnerAgreementManager;



{

[Serializable]

public class PartyUtilities

{

public Int32 GetPartyIDFromPartyName(string inPartyName)

{

Partner varNet_ParAgrMan_Partner = new Partner(inPartyName);

Int32 varInt32_PartyId = varNet_ParAgrMan_Partner.PartyId;

return varInt32_PartyId;

}

}

}



Now, with above configuration, ensure the orchestration sends the edi messages to the biztalk message box with those three properties set, this is done by sending to ‘direct bound’ send port.



When the edi message gets into biztalk message box, already subscribed batch orchestation(looking for those 3 properties exist) will fetch the message and apply the batching rule configured for the filted partyID and it will release the batch to message box by setting EDI.ToBeBatched=False.

Configre a stand alone send port with filter condition of :

EDI.DestinationPartyName == Trading party name And

EDI.ToBeBatched == False

Configure this send port the EDI Pipe line ‘edisend’ to spit out the native batched edi file. To select edi send pipe line the project should reference to the Microsoft edi batch project.