Aug 2019
EDI-ANSI-ASC-X12-Technical Overview
(Last Updated On: August 19, 2019)


EDI ANSI ASC X12 Standards – Technical Overview – 2019

Understanding the Basics of  EDI ANSI ASC X12

This article describes the EDI ANSI ASC X12 standard (American National Standards Institute Accredited Standards Committee X12). The article is intended for beginners who are just starting to work with EDI ANSI ASC X12 format but may also be interesting to professionals who already have experience in EDI X12.

In this article, you will learn general terms (Interchange, functional group, document), a detailed description of the main components of an EDI document (segments, elements) and the relationship between each one of those elements. It then describes how documents are constructed from these components, and their hierarchical structure is analyzed in detail. At the end of the article, I will briefly describe how EDI is used in the current reality of electronic document and messaging management.

EDI History

EDI Electronic Data Interchange is an exchange between computers of structured information, according to mutually agreed rules.

EDI began to be used in the mid-60s in the rail and road transport sectors, for the first time. In 1968, a committee was organized by the United States Transportation Data Coordinating Committee (TDCC) to work on an electronic document management standard for the industry. Later, the American National Standards Institute (ANSI) began to work on the expansion and improvements of the standard.

In the 70s, (when ANSI ASC X12 standard was developed) the small size of an electronic document was very important, and each byte of the electronic document had to carry maximum information, to increase the “information density” of an electronic document, that is why “readability” has been denied.

At that time, communication between companies was far from ideal, and there was frequent cases of line breakage and data loss. Therefore, the format of the electronic documents was developed to preserve the integrity of the data, for which the envelope mechanism and the control numbers were used, which allowed a verification mechanism that the transmitted data was not violated or lost.

An EDI standard can be defined as a set of rules defining the structure and format of an EDI document.

There are several organizations that are currently working on EDI standards:

  • ANSI (American National Standards Institute) – This is an institute that sets standards for many activities. EDI is handled by the Accredited Standards Committee X12 ASC X12, the main U.S. organization for EDI standardization.
  • EDIA (The Electronic Data Interchange Association) – this association was formerly TDCC (The Transportation Data Coordination Committee) in the United States; it administers the development of standards in the transportation and other industries.
  • AIAG (The Automotive Industry Action Group) – not-for profit association and group of standards for the automotive industry. This standard is a subset of ANSI X12 standards.
  • EDIFACT (Electronic Data Interchange for Administration, Commerce, and Transport.) EDIFACT standard, unlike ANSI X12, is used mainly in Europe, while X12 is used in America.
  • ODETTE (The Organization for Data Exchange by Tele-Transmission in Europe.)

The EDI ANSI ASC X12 standard (or simply X12) includes a description of document formats (transaction sets) and has different versions (related to development standards) – 4010, 5010, 5020

EDI Terminologies:

Interchange (or Envelop)

Interchange is structured (according to the rules defined by the X12 standard) data set exchanged between business partners in the electronic workflow.

Interchange is more than just a document; rather, it is a package of groups of documents (although interchange may contain only one group with one document).

In the future, I will use the term “EDI document” if we are talking about Interchange and simply “document” if we are talking about a separate document (transaction set) from this Interchange.

The Interchange structure can be depicted (later I will analyze the component parts and structure in more detail):

EDI Interchange structure

Interchange begins with the ISA segment and ends with the IEA segment (ISA / IEA Envelope).

X12 defines each EDI document as a set of segments and elements that define this document. Approves the order of the segments in the document, the order of the elements in the segment and the relationship between the segments and / or elements.

In X12, each specific document, for example, an invoice, a purchase order, has a three-digit number identifier. For example, an invoice is 810, PO – 850, ASN (Advance Ship Notice)- 856, etc. more detailed list of EDI X12 documents with its identifier you can find at EDI Document Library

EDI X12 – Functional Group

A functional group is a group (set) of documents of the same type (orders, invoices, etc.) that are included in the Interchange. The EDI structure will be described later, but for now, just note that the beginning and end of the functional group are determined by the GS/GE segments (GS/GE Envelope). The type of functional group is determined by the element GS-01 (for example, the functional group PO contains Purchase Orders, the functional group IN – invoices). The GS segment is also sometimes used to route documents between departments of a partner receiving documents.

Document (or Transaction Set)

The X12 standard uses the term “document”, or “transaction set”. A document is a set of data that, overall, represents complete and valuable information for the business partners. In most cases, the transaction set is a standard document that companies use in their work – for example, Invoice or Purchase Order. Please note that one or multiple transaction sets can exist in one Functional Group.

How does an EDI document look (example)

ISA*00*          *00*          *ZZ*A1STORES    *12*5142645505     *190510*0728*|*00403*100000013*0*P*}





PER*BD*Contact Name*TE*123-456-7890




TD5*****Carrier Routing*******CG

N1*ST*Towner Square Schooms*92*006

N3*Williston Towner Square*2100 11th St SW




PID*F*08***Nike Boy Short Black sz M



PID*F*08*** Reebok Boy Short Abstract Print sz M



PID*F*08*** Puma Boy Short Red sz M





It should be noted that in the EDI example above, the line breaks between the segments are set up specifically to make it easier to “see” the data structure. In fact, line breaks are not used (or ignored) and this EDI document in the original would have to look like a “single line”. However, for convenience, in the examples of this article, I will separate the segments from each other using a new line.

Let’s go back to the EDI document example. For the GS segment, which comes second, you can determine that this is an EDI document of the X12 (X) standard, version 4030 (004030). According to the ST segment, we can say that this is an 850 document or a Purchase Order. For the rest of the content, you can determine that we are talking about ordering Boy Shorts, find out their price and quantity.

What is an EDI envelope?

To better represent the structure of the EDI document, you can make an analogy with the usual “paper documents” that are sealed in envelops.

The uppermost envelope ISA / IEA contains one or more functional Groups (GS/GE Envelopes) that contain the documents themselves, each in a separate envelope (ST/SE Envelopes).

The ISA / IEA envelope contains the addresses of the recipient company and the sending company.

On the GS / GE envelope is “written” the type of documents contained in it, they are denoted as a two-letter code. (functional ID code). For example, PO for 850 Purchase Order, IN for 810 Invoice. Such an envelope contains only documents of the same type. GS also contains sender’s and receiver’s ID code, functional Group control numbers, date and time.

Functional Group Header (GS)

Functional Group Trailer (GE)

Functional Group Trailer (GE)

EDI segments

A segment is a combination of related elements or composite data that are grouped together to provide useful information. For example, a segment may contain information about a product, color, weight, size, volume, etc. A segment may be present in a document once or may occur several times, depending on the business need.

edi x12 Segment

In X12 a unique identifier for a segment (tag) always comes first, it consists (usually) of 2-3 letters/numbers.

X12 Segment Example:


A segment consists of an identifier (tag) and elements separated by special characters (element separator) – in our example, this is an asterisk – “*”. It should be noted that the delimiters of elements and segments may differ from this example.

The standard defines the order of the elements in the segment. The example above shows the X12 standard segment named PO1.

Segment optionality

Segments in a EDI X12 document have two types of optionality:

M (mandatory) – a mandatory segment. Typically, such segment contains the basic information of the document (without mandatory segments, the document cannot be fully and/or correctly understood). If the standard defines a segment as mandatory, it cannot be omitted from the document. Examples of required segments:


This is the (BEG) segment of the header, it contains general document information:

  • Destination (00 – Original)
  • type (SA – Stand-alone Order)
  • order number (2332233)
  • 20190510 – Mai 10, 2019

Without this segment, this order could not be identified.


PO1 part segment contains basic product data. PO is used to order goods, and product information is the main data of this document, therefore this segment is also mandatory.

O is an optional segment. Usually, these are segments containing secondary/auxiliary information. If the standard defines a segment in the document as optional, then it can be either present or absent, and the absence of an optional segment will not be an error. An example of an optional segment:

PER*BD*Contact Name*TE*123-456-7890

This is a PER segment – Administrative Communications Contact, i.e. “contact information”. This segment contains the following information:

  • BD- Buyer Name or Department
  • TE – Telephone
  • The phone number itself 123-456-7890

This information is optional, without it this document can be read – what is ordered, quantity, cost, etc.

Segments Order

In an EDI document, the segments follow each other in the order defined by the standard.

Repeat segments

As you may have noticed, in the sample document some segments are repeated. Some of them follow one after another (e.g. DTM), some are repeated as part of groups (e.g. PO1 / CTP / PID). There are two types of “repeat” segments:

Reusable segment

In this case, a segment can be repeated several times, but each segment has a different meaning, i.e. carries different information (similar in meaning, but different in content). For example, two DTM segments in the example above EDI 850 document determine the dates, but the first one (DTM*010*20190517) determines requested ship date (earliest ship date requested), and the second (DTM*001*20190525) determines the last day that merchandise should be delivered (latest ship date requested)

In most cases, a segment has a special element that identifies the contents of a segment. In the DTM segment, this is the DTM-01 element. The standard defines the maximum number of such repetitions. (max use).

Cyclical repetition of data (Loops)

A cyclic group of segments (loop) is a set of interconnected segments that are repeated in an EDI document in a specific sequence. For example, a group of segments N1 / N3 / N4 represents address information, where N1 carries information about this address, N3 is the address itself, and N4 is the geographical location.

N1*ST*Towner Square Schooms*92*006

N3*Williston Towner Square*2100 10th St SW


The PO1 / CTP / PID group carries information about the ordered product (PO1), its price (CTP) and description of this product (PID)



PID*F*08***Nike Boy Short Black sz M

EDI Document Structure

As mentioned above, an EDI document can be presented in the form of documents enclosed in envelopes that have different purposes.

The initial segments of each section, is called Header, and the final segment is called Trailer:

  • ISA – Interchange Control Header – this is the segment that defines the sender and recipient of a document.
  • GS – Functional Group Header. – this segment defines the type of document(s) that are included in this group, contains control information. It can be used to route an EDI document between different systems and / or addresses of companies that exchange these documents. Once again, the GS / GE segments are an envelope for documents of the same type (the type is determined by the GS-01 segment).
  • ST – Transaction Set Header – the segment identifies the type of document. This segment starts the document (for example, an order or invoice). As mentioned at the beginning, in X12 the document type has a three-digit identifier number. (ST*850*1013)
  • SE – Transaction Set Trailer – the segment defines the end of the document. This segment contains information about the total number of data segments (including ST and SE segments). This number is used to verify the document. (SE*22*1013)
  • GE – Functional Group Trailer– the segment defines the end of the data that was started by the GS segment. Several functional groups can be included in an EDI document; the GE segment is used to determine where the functional group ends.
  • IEA – Interchange Control Trailer – is ending Interchange segment. (IEA*1*100000013)

EDI document: Header, Details, and Summary

As mentioned above, an EDI document (transaction set) is a set of data that together represent complete information that is valuable to the business partners (parties involved in the workflow). Examples of documents – an order, an invoice, a document with information about discounts, a catalog, etc. Each document is enclosed in an “envelope” ST / SE, which indicates the type of document. The document (or transaction) is divided into three groups – Header, Details, and Summary.

Header, Details, and Summary EDI x12

The Header of the document contains common information – for example, number, contact information, dates of loading / delivery, addresses, etc.

The details of the document include the contents of the document, for example for an order – information about the ordered product, quantity and price for this type of product.

The Summary data usually contains summary information – for an order it may be the number of types of goods ordered, for an Invoice – the total cost of the goods, general discounts, etc.

Using EDI in business

EDI is used in many industries where information exchange is required. This is primarily trade, insurance, medicine, transport logistics, etc.

Major retailers such as Walmart, Kroger, K-Mart, and others use EDI X12 to exchange electronic documents with their trading partners. They specify the format of the documents they send themselves and which they expect from suppliers. Supplier companies that want to work with these retailers are required to use these formats – otherwise, they will not be able to “understand” what the retailer is ordering, or the retailer will not be able to “understand” the invoice.

Typically, the set of documents exchanged between a retailer and suppliers include the following most commonly used documents:

  • EDI 850 – Purchase Order (PO)– information about the ordered product: quantity, name, description, etc. Sends a retailer.
  • EDI 856 – Advanced Ship Notice/Manifest ASN – a document on the assembly and packaging of goods, for example, 10 pallets, each with 4 boxes, each box with 100 units of goods. Weight / Volume Information. Dispatches a supplier.
  • EDI 810 – Invoice – bill of goods. Dispatches a supplier.
  • EDI 820 – Remittance Advice – proof of payment. Sends a retailer.
  • EDI 997 – Functional Acknowledgement – a special type of document that is sent automatically in response to an EDI document (confirm receipt) and contains information about unrecognized/unprocessed data (where appropriate).

EDI is the connecting suppliers and retailers. The retailer, determining the version and format of EDI documents, and establishes strict rules for EDI exchange with its trading partners.

EDI allows business partners to minimize errors (primarily human), unify their workflow, automate processes, clearly establish communications with their partners, and much more.

Free EDI consultation