by CData Arc Marketing | December 27, 2020 | Last Updated: December 17, 2024

How to Understand EDI Documents and Avoid Costly Errors

money concept

Electronic document interchange (EDI) enables organizations to work efficiently with business partners by automating the exchange of trading-related documents, such as purchase orders, invoices, and shipping notifications. Unfortunately, because EDI was designed for use by primitive machines in the 1960s, the various EDI formats are nearly incomprehensible to humans.

So, what are you looking at in an EDI document? More pertinently, how do you know your EDI files don't contain any costly syntactical errors that lead to missed orders, delays, or costly inventory inaccuracies?

In this article, we walk you through the common EDI file format standards and the main components of an example X12 standard EDI 850 Purchase Order document so you can better understand what you're looking at and more easily determine when something has gone wrong. We will cover four of the most common EDI standards and while the pieces of the EDI 850 Purchase Order will not perfectly correspond to other documents, the structure broadly applies to other X12 EDI files.

Learn More: Understanding EDI: How It Works & How It’s Used

4 types of EDI files

  1. ANSI ASC X12
    • The ANSI (American National Standards Institute) ASC (Accredited Standards Committee) X12, commonly known as X12, is one of the most widely adopted EDI standards worldwide. Originally developed in North America, X12 provides a comprehensive format for exchanging business documents with over 300 standardized file types for industries such as retail, transportation, finance, and healthcare.
    • Example X12 810 (Invoice):
      ISA*00*          *01*          *ZZ*NOTP           *ZZ*NOTP           
      *050108*0954*U*00501*000000001*0*P*>
      GS*IN*NOTP*NOTP*20050108*0954*1*X*004010
      ST*810*0001
      BIG*20021119*184*20021015*BMB
      REF*IA*040682
      N1*BT*WALGREEN*92*0000
      ITD*02**1.000**30**31*****1% 30 NET 31
      FOB*CC
      PID*S**VI*FL
      IT1*0001*267*CA*53.52**IN*859067
      PID*F*08*VI**Product Description
      TDS*1421839*1428984
      CAD*T***CFWY*CONSOLIDATED FREIGHTWAYS
      SAC*A*D240***7145**********FREIGHT CHARGE
      ISS*267*CA
      CTT*1
      SE*15*0001
      GE*1*1
      IEA*1*000000001
  1. EDIFACT
    • EDIFACT (Electronic Data Interchange for Administration, Commerce, and Transport) is a global EDI Standard established by the United Nations. It is predominantly used in Europe and Asia and supports many industries such as international trade, logistics, and finance.
    • Example EDIFACT INVOIC (Invoice):
      UNB+UNOA:2+SENDERID:ZZ+RECEIVERID:8+080909:1357+807
      UNH+000012102+INVOIC:D:97A:UN:EAN008
      BGM+380+ABCD1234+9
      DTM+137:19980110:102
      RFF+ON:0123456789123
      NAD+BY+BUYERID::31B
      NAD+SU+SUPPLIERID:31B
      NAD+DP+DELIVERYPARTYID:31B
      LIN+1
      PIA+5+0835201031:IB
      QTY+47:2
      PRI+AAA:8.4
      PRI+AAB:10.5::SRP
      ALC+A
      PCD+3:20
      LIN+2
      PIA+5+0835208338:IB
      QTY+47:1
      PRI+AAA:24
      PRI+AAB:30::SRP
      ALC+A
      PCD+3:20
      UNS+S
      MOA+86:40.8
      CNT+2:2
      CNT+1:3
      UNT+26+000012102
      UNZ+1+807
  1. TRADACOMS
    • Developed in the United Kingdom, TRADACOMS is an earlier EDI standard that was primarily designed for the retail industry. While it has been largely replaced by the EDIFACT standard, TRADACOMS is still used by companies today in the United Kingdom for transactions like orders, invoices, and shipping notifications.
    • Example TRADACOMS ORDHDR (Order Header):
      MHD=1+ORDHDR:9' 
      TYP=0430+NEW-ORDER'
      SDT=SupplierID'
      CDT=CustomerID'
      FIL=1630+1+070315'
      MTR=6'
      MHD=2+ORDER:9'
      CLO=5000000000283:89828+ShipTo'
      ORD=70970::070315'
      DIN=070321++0000'
      OLD=1+5010210000000++:CustomerCode+12+60++++ItemDescription'
      OTR=1'
      MTR=7'
      MHD=3+ORDTLR:9'
      OFT=1'
      MTR=3'
      END=3'
  1. HL7
    • HL7 (Health Level Seven) is an EDI standard developed by the Health Level Seven International organization that is specifically tailored for the healthcare industry. HL7 plays an important role in ensuring compliance with regulations like HIPAA while it facilitates the secure exchange and integration of electronic health information through various EDI document types.
    • Example HL7 ADT^A01 (Patient Registration):
      MSH|^~\&|SENDING_APPLICATION|SENDING_FACILITY|RECEIVING_APPLICATION|RECEIVING_FACILITY|20110613083617||ADT^A01|934576120110613083617|P|2.3||||
      EVN|A01|20110613083617|||
      PID|1||135769||LastName^FirstName^||19281118|M|||Address^^City^State^Zip||(555) 555-5555^^^[email protected]|||||1719|99999999||||||||||||||||||||
      PV1|1|O|||||^^^^^^^^|^^^^^^^^

Elements of an EDI document

diagram

The message structure for all X12 standard EDI documents includes three key components illustrated in the diagram below:

  • Interchange
  • Functional group
  • Transaction set

The interchange and functional groups work together and serve as an address that directs the message to the proper destination, while the transaction set describes the message itself. The two-to-three-character codes at the right of the X12 Document Structure diagram indicate these structural components.

EDI codes

Here, we show how these codes look in an EDI document where they describe structural components. The text below is an example of an EDI transaction document, in this case, an 850 Purchase Order.

As you can see, the document comprises strings of unintelligible characters. But they can be understood as a collection of segments.

  • Each line of the document is called a segment
  • Segments are composed of one or more elements
  • Each segment is followed by a terminator/separator (usually a tilde)

In this example, we've placed each segment on its own line to make it easier to distinguish. But beware that EDI files typically come in a big block with no carriage return, only the terminator/separator.

      ISA*00*          *00*          *ZZ*AMAZONDS       *01*003025392      *160623*1448*U*00401*000000013*0*P*+~
GS*PO*AMAZONDS*ATFDS*20070911*2001*95*X*004010~
ST*850*0003~
BEG*00*DS*TesT0008516**20070805~
CUR*BT*USD~
N1*BT*Amazon.com.kydc,Inc.*92*KYDC~
N1*SF*WHSE*92*WHSE~
N1*ST*Charlie Dinkins~
N3*11254 Main St*Suite 112~
N4*Seattle*WA*98104*US*CC*United States~
TD5**92*UPS_GR_RES****ZZ*RES~
N1*LW*Amber Baker~
N3*123 Anderson Avenue~
N4*Seattle*WA*98103*US~
PO1*1*3*EA*18.04*NT*SK*1617*****BL*1*ZZ*Amazon.com~
PO1*2*2*EA*54.42*NT*SK*4927*****BL*1*ZZ*Amazon.com~
PO1*3*1*EA*18*NT*SK*9876*****BL*1*ZZ*Amazon.com~
CTT*3*6~
SE*15*0003~
GE*1*40~
IEA*1*000000040~

Interchange

The interchange consists of a header and footer that identify the company you're sending the document to. X12 uses the codes ISA for the header and IEA for the footer.

The ISA header provides metadata about the exchange. For example, it includes a unique identifying number for the transaction, which can also be used after the document is received as an acknowledgment. The IEA code at the end of the document completes the exchange.

Functional group

The functional group directs the message more specifically to a particular area or department in the company. For example, the functional group might include all the invoices bound for the accounting department. X12 uses the code GS for the Functional Group header and GE for the footer, which is located respectively in the second and penultimate lines of the above document. If the company is small or the address is simple, the GS may repeat the ISA code.

Transaction set

The transaction consists of the main body of the message, such as the order details. The following codes define various aspects of the transaction. ST stands for Start Transaction and defines the type of message being sent. Here, the ST is 850, meaning the document is a purchase order. The SE (in the third to the last line above) is the closing tag that ends the transaction that began with the ST.

You'll typically find a number of different codes within each transaction:

ST2 —Each interchange can include multiple transactions, such as multiple 850s, an 850, and an 810, or some other combination. ST2 identifies each one.

BEG — Stands for Beginning and includes high-level metadata about the 850, such as PO number, PO date, order number, and so on.

REF — A reference identifier. Companies have broad flexibility to choose from a range of identifiers, such as customer order number, customer reference number, sales program number, or a special processing code.

N1 — Identifies a party to the exchange, such as the buyer, the shipper, or the remit-to party, using information such as their name, role, and identifier.

N3 and N4 identify the address of the party referenced in N1.

PO1 — A purchase order can include multiple items. The PO1 identifies each item with a unique ID. Companies have the flexibility to define what kind of identifier they use, e.g., a UPC or an ISBN. The PO1 also describes the quantity ordered and price per unit.

PID — Part of the PO1, the PID can provide additional identifying information, such as color, weight, and dimensions.

CTT — Aggregates the total number of line items and the total cost of all those items.

Learn More: What Are EDI Transactions? A Complete Guide with Examples

Seeing the codes more clearly

While you can now see and understand the basic EDI segments, translating the EDI document to another format makes it easier to understand your EDI documents at a glance. For example, if you convert an EDI format file to XML format in a simple point-and-click process, you can easily insert comments that document what each segment does, making it easier to read and understand.

Learn More: Types of EDI: Messaging Protocols

CData Arc: Automate EDI with drag-and-drop EDI mapping

CData Arc is a powerful EDI software suite that makes it easy to translate your documents into XML, Excel, CSV, or any flat file format. CData Arc supports EDI mapping and translation for EDI 850, 837, 810, 270, and hundreds more standard EDI document types across more than a dozen major EDI standards.

To test out the CData Arc translation process, download a trial version today and learn how to automatically convert EDI files into business formats in our EDI Mapping Tutorials.

Explore CData Arc today

Take an interactive tour to discover how Arc can simplify your EDI integration, translation, transmission, and mapping—all in one user-friendly interface.

Take the tour