The video is available at http://msdn.microsoft.com/en-us/biztalk/video/gg153513

This is the fourth video of the BizTalk Server 2010 EDI tutorial. In the last video, we created send and receive ports that are used to transfer messages between trading partners. This video demonstrates how to create a trading partner agreement between two business profiles.

I am pasting the transcript of the video here to increase the search hits.

************************************************************************************************************************************************

This is the fourth video of the BizTalk Server 2010 EDI tutorial.  In the last video, we created send and receive ports that are used to transfer messages between trading partners. In this presentation, we will create the trading partner agreement between the two business profiles, Procurement System and Order System.

A trading partner agreement, also known as an agreement, is the most important element in trading partner relationship and forms the backbone of partner to partner EDI messaging in a BizTalk Server environment. There can be two types of agreements:

  • Encoding agreement, which governs what message encoding protocol is used, such as X12 or EDIFACT…..
  • Transport agreement, which governs what message transport protocol is used, such as AS2……

In this tutorial, we use FILE adapters to send and receive messages… so we do not need to have a transport agreement. We will only create an encoding agreement….. An encoding agreement is mandatory between two trading partners for EDI message transfer.

Before we get started with creating the agreement, let’s recap a couple of things:

  • In the second video of the EDI tutorial video series, we did not add protocol settings for the two business profiles we created….. We did so because we will now add those settings as part of the trading partner agreement.…. Had we added the protocol settings at that stage, we could have modified or overridden those as port of the agreement.
  • In the first video of the EDI tutorial video series we saw that a SamplePO.txt file is installed for the tutorial. The file actually contains the message that will be sent from Procurement System to Order System….. Open the message and you will notice that it is an X12 message. So, we will create an X12 encoding agreement.

The values that you provide while creating a trading partner agreement are mostly very closely related to the EDI message that will be transferred. So, it will be worthwhile trying to understand a typical X12 message by looking at the SamplePO.txt test message.

  • The first line in the message is called the interchange control header and starts with ISA…. Each entry, separated by a delimiter, in the ISA header corresponds to a value…. In this message, the delimiter is an asterisk…. The delimiter is also agreed upon by both trading partners and is specified as part of the agreement…. The value after the first delimiter occurrence is interpreted as ISA1, so on and so forth…. For example, in this message, ISA5 is ZZ….. The ISA interchange control header fields in an X12-encoded message are of fixed length…. For some of the fields, you can enter a value less than the fixed length of the field. If you do so, the interchange must contain trailing spaces (for a string field) or leading zeroes (for a numerical field) so that each field is of the required length.…. That is why you see so many trailing spaces after “THEM” and “US” in the message….

The last line in the message is the interchange control trailer and starts with IEA. The interchange control header and trailer occur just once in the message….

  • Typically, the second line of the message is the functional group header and starts with GS…. Here again, each entry is separated by a delimiter…. In this message, GS01 is “PO” that stands for Purchase Order, signifying that the message is a purchase order message.

In an EDI message, for each functional group header, there is a corresponding functional group trailer starting with GE…. You can have any number of functional group header or trailer in a message.

  • Within functional group headers, you have transaction set headers starting with ST…. The values in the transaction set header are also separated by delimiters…. In this example, ST01 is specified as 850, which is the transaction set ID for purchase order messages….. For each transaction set header, a message has a transaction set trailer starting with SE…..
  • Each transaction set in turn contains the segments that actually carry the business data….

For more information about an EDI message structure, see http://go.microsoft.com/fwlink/?LinkId=201215.

When you create an agreement, certain values that you enter for the agreement properties (such as ISA5, ISA6, etc.) are matched against the values for the same properties in the message….. If the values match, the message resolves to the agreement …. The properties set in that agreement are then used by BizTalk Server to process the message….. There’s more to agreement resolution than this. There are different stages of agreement resolution and an agreement resolution is required for both incoming and outgoing EDI messages……

Create the Trading Partner Agreement

Let us now start with creating the trading partner agreement. In the BizTalk Server Administration console, right-click any of the trading partner or business profile you have already created, and then click Agreements.

  • You may choose to specify a new name for the agreement or go with the default name.
  • Select the protocol…. For this tutorial, you must select X12 because like we mentioned earlier, the message sent from Procurement System to Order System is an X12 message….
  • The details about one partner and business profile are already available; you must select the other partner and business profile.

As soon as you select the other partner and profile, notice that two tabs get added in the dialog box next to the General tab….. Each tab represents a one-way agreement….. Fabrikam to Contoso tab will contain the agreement properties for all messages being sent from Fabrikam, for example the purchase order message that Procurement System sends to Order System….. Similarly, Contoso to Fabrikam tab will contain the agreement properties for all EDI messages sent from Contoso to Fabrikam, for example the 997 acknowledgement that is sent in response to the purchase order message.

Notice that the Protocol Set is empty for both trading partners… this is because when creating the business profiles in the second video, you did not specify any protocol settings…. Had you specified the settings then, they would have shown in these drop-downs and you could have selected those…. You could have also modified the protocol settings only for this agreement…

  • Make sure the agreement is enabled….. You can choose to enable the agreement immediately or select a later date….. You can also select a date by which the agreement will be disabled.
  • If you select the Turn ON Reporting check box, you can also see the EDI message entries for the interchanges in the status reporting UI of the Group Hub page…. If you also want BizTalk Server to store the transaction sets within the interchanges in the tracking database and also have them displayed as part of status report, you should also select the Store message payload for reporting check box.
  • In the Fabrikam to Contoso tab, on the Identifiers page, enter the values for qualifier and identifier fields…. For ISA5 enter select ZZ - Mutually Defined … For ISA6 enter THEM…. For ISA7 select ZZ - Mutually Defined ….. For ISA8 enter US. The values you enter here, will be matched against the values in the interchange header of the EDI message…. And if a match occurs, this agreement will be used to process the EDI message.
  • According to the scenario in this tutorial, Fabrikam expects a 997 acknowledgement message after sending the purchase order EDI message…. So, to have BizTalk Server generate and send the acknowledgement, select the 997 Expected check box on the Acknowledgements page.
  • While describing the business scenario, we also saw that we use a separate send port to send the acknowledgement back to Fabrikam.….. So, on the Local Host Settings Page, clear the check box for Route ACK to send pipeline on request-response receive port….. This option must be checked only if you are using the same receive-response port to send the acknowledgement back to the trading partner.
  • For testing purposes, we tend to send the same message again and again….. To enable that, make sure the Interchange Control Number check box is cleared on the Validations page. If this option is checked, BizTalk Server won’t process the same message again…… BizTalk Server does so by comparing the values of ISA13 in the message header.
  • The message received from Procurement System is an EDI message in TXT format which is converted to a message XML by the EDIreceive pipeline….. To process the XML message, BizTalk Server needs to determine a schema….. It does so by using the target namespace defined as part of the agreement….. You provide the target namespace in the Local Host Settings page….. If the values entered in this grid for ST1 and GS2 match with those in the EDI message, BizTalk Server uses the target namespace defined in the grid against the values to determine the schema. If no match is found, the target namespace marked against the default selection is used.

For this tutorial, select the checkbox in the Default column….. for ST1, select 850 – Purchase Order….. for GS2, enter THEM…. and for Target Namespace select http://schemas.microsoft.com/BizTalk/EDI/X12/2006.

  • You have now finished entering the agreement properties for incoming messages, that is, messages that will be received from Procurement System….. You must now specify agreement properties for messages that will be sent from Order System to Procurement System (such as acknowledgement)….. You can do so from the Contoso to Fabrikam tab in the agreement properties dialog box.
  • On the Identifiers page, enter the values for qualifier and identifier fields. While sending the acknowledgement, the roles are reversed… the sender of purchase order message is now the receiver… and the receiver of purchase order message is now the sender… So, the values you entered will also be reversed... For ISA5 enter select ZZ - Mutually Defined … For ISA6 enter US…. For ISA7 select ZZ - Mutually Defined ….. For ISA8 enter THEM….
  • On the CharacterSet and Separators page, verify the values entered for different separators. Change the value for Suffix to CR LF (or Carriage Return Line Feed) to denote the end of line …. These values will be used to form the acknowledgement message….
  • On the Send Ports page, from the grid, select the send port you created in the last video to send the acknowledgement back to Procurement System. The name of the send port was toTHEM_997.
  • To construct a well-formed EDI acknowledgement message, BizTalk Server needs the values that can be used to make the envelope of the acknowledgement message.…. It gets those values from the Envelopes page….. The send pipeline matches the transaction set type, the X12 version, and the target namespace with the corresponding values in the header of the message…. If successful, it uses the GS values associated in the grid to form the acknowledgement message…..

Enter the values for all the fields in the grid… Make sure you select the check box in the Default column…. This ensures that BizTalk Server uses the GS values, even if the transaction type, version, and target namespace does not match with the message values.

Make a note of the values you enter in the grid…. In the next video, this will help you in verifying the acknowledgement message that is generated and sent to Procurement System.

  • Save the agreement and verify if it is enabled.
  • If you turned on reporting, you must also start the BizTalk service. To restart the BizTalk service, under Host Instances, right-click BizTalkServerApplication, and click Restart.

This concludes the fourth video of the BizTalk Server 2010 EDI tutorial. In the next video, we’re going to test the application by dropping the test message to file folders. Thank you for watching.

************************************************************************************************************************************************