Getting Started with Logic Apps - EDI X12 Fundamentals | X12 EDI Basics | ANSI X12 EDI Format

{tocify} $title={Table of Contents}


Few days back I was contacted by a beginner asking to guide on getting started on Logic Apps and EDI X12, although I tried to help him over call but thought of writing a post so that other beginners can be benefited. Have tried to cover basics of EDI X12 in this post and how to use it in context to Logic app in following post - Getting Started with Logic Apps - XML to EDI X12

What is EDI?

In Layman term any data which is interchanged using electronic medium can be said as Electronic data interchange (EDI) .

Wikipedia says - Electronic data interchange (EDI) is the concept of businesses electronically communicating information that was traditionally communicated on paper, such as purchase orders and invoices.

Traditional way

Here the documents are created, put together in an envelope and sent across via mail/courier service and delivered to the receiver. In acknowledgment to receipt of documents, the receiver would sign on the delivery receipt and the sender may be informed back by mail/courier service provider.
Traditional Way of business
The sender can send a single document, say a single purchase order or multiple Purchase orders in an envelope. Also they can send Purchase order and Invoice document in an envelope to same receiver.

Details like whom to deliver, who is sender (To and From address) were provided over on an envelope by the sender and the mail service provider would stamp it which would then imply the date and time etc.

EDI way

EDI way can be defined as the transfer of structured data, by agreed message standards, from one computer system to another without human intervention.

EDI Way of business

There are many standards like  X12, EDIFACT, TRADACOM,ODETTE, etc. based on regions, business domains, government laws and lot of research but the intention of all is to define structured way for the entities/organizations/business  to create and send the documents.

The EDI standards are designed in such a way that it helps to create documents with most of the details along with the Interchange details (envelope details like To, From, Timestamp etc), and are released for use as a specific version e.g., 4010, 5020, 6010 etc.

Each time there is change i.e., amendments or reductions in the fields, change of data types etc then a new version is released, it can be major or minor release.

Say 4010 is current version in use and if some major changes are introduced then next version becomes 5010(version 5 Release 1) else if it is minor version then next version becomes 4020 (version 4 Release 2).

And certainly adding following benefits
  • Time and cost saving
  • Increase processing Speed
  • More Accuracy due to elimination of Manual errors
  • Secure and simple

EDI X12 Standard

EDI X12 is governed by standards released by ASC X12 (The Accredited Standards Committee) mainly used in US. Each release contains set of message types like invoice, purchase order, healthcare claim, etc. Each message type has specific number assigned to it instead of name. e.g., purchase order is 850, an invoice is 810 etc.

EDI Standards prescribe following:

  1. Formats, character sets and data elements used in the exchange of documents.
  2. The envelopes used in EDI transaction.
  3. The acknowledgements required to verify delivery
  4. How to provide guaranteed, exactly once delivery and automatic detection and reporting of corrupted and incorrect data.

List of EDI X12 documents -  EDI X12 Documents List

Standard EDI X12 format data is text file separated by segment, segment delimeter, element , element delimeter and sub-element delimiters.
Segments always begin with a 2-3 letter code like ST or ISA. Some segments are mandatory, while some are not.

The mandatory segments of X12 are:

ISA(Interchange header) 

It is the first segment and unlike any other segment in X12, ISA is fixed length of 105. This has information about the sender and recipient, version number.

The ISA Segment has the following structure

ISA01 Authorization Information Qualifier (length – 2)
ISA02 Authorization Information (length – 10)
ISA03 Security Information Qualifier (length – 2)
ISA04 Security Information (length – 10)
ISA05 Interchange ID Qualifier (length – 2)
ISA06 Interchange Sender ID (length – 15)
ISA07 Interchange ID Qualifier (length – 2)
ISA08 Interchange Receiver ID (length – 15)
ISA09 Interchange Date (length – 6)
ISA10 Interchange Time (length – 4)
ISA11 Interchange Control Standards ID (length – 1)
ISA12 Interchange Control Version Number(length – 5)
ISA13 Interchange Control Number (length – 9)
ISA14 Acknowledgment Requested (length – 1)
ISA15 Test Indicator (length – 1)
ISA16 Subelement Separator (length – 1)

GS(Functional group header) 

   It is the second segment and is a set of X12 documents of the same document type (transaction set). It has information about the functional group, e.g. codes for the sender, recipient, and date/time of preparation.

The GS Segment has the following structure

GS01 - Functional Group Header Code(min/max – 2/2)
GS02 - Application Sender's Code(min/max – 2/15)
GS03 - Application Receiver's Code(min/max – 2/15)
GS04 - Date(min/max – 8/8)
GS05 - Time - HHMM(min/max – 4/8)
GS06 - Group Control Number(min/max – 1/9)
GS07 - Responsible Agency Code(min/max – 1/2)
GS08 - Version Code(min/max – 1/12)

ST(transaction set header) 

    It is the third segment, this marks the start of a transaction set in an interchange.

The ST Segment has the following structure

ST01 - Transaction Set Identifier Code - A three digit numeric code identifying the Transaction Set type
ST02 - Transaction Set Control Number

SE(Transaction set trailer)

   This marks the end of a transaction set.

The SE Segment has the following structure

SE01 - Number of included segments
SE02 - Transaction Set Control Number - Must match the Transaction Set Control Number in the ST.

GE(Functional group trailer) 

    Segment of a set of X12 documents of the same transaction set. It tells you the number of functional groups and the control group number. It also marks the end of a group of transaction sets.

The GE Segment has the following structure

GE01 - Number of included Transaction Sets
GE02 - Group Control Number - Must match the group control number of the GS

IEA(Interchange trailer)

    this marks the end of the interchange. It contains information about the number of functional groups and the interchange control reference number. 

The IEA Segment has the following structure

IEA01 - Number of Included Functional Groups
IEA02 - Interchange Control Number - Must match the control number in the ISA.

i. There will be only one ISA and IEA segments present in an Envelope
ii. There can be multiple GS in an envelope.
iii.There can be multiple ST's

Above mandatory segments will be part of  every EDI X12 document no matter if it is EDI X12 850, 855, 810, 856 etc but the segments between ST and SE can vary from document to document.

If compared to XML structure - a segment is equivalent to a record type and each segment is separated by segment delimeter .A segment is composed of one or more data elements or composite data structures, which are equivalent to the fields in a record and each element is separated by element delimeter.

EDI X12 850 Sample

In the EDI X12 850 sample shown below "*" is the element separator and "~" is the segment separator. It has details of a single purchase order with two items.

ISA*00*          *00*          *ZZ*Techfindings   *ZZ*EDIPartner     *191031*0943*U*00401*000000010*0*T*:~
N1*BT*Maheshkumar Tiwari**2341~


EDI X12 messages are wrapped with an envelope, at header it has ISA segment (Interchange control header), GS (Functional group) and ST (Transaction Set) and at the trailer it has IEA, GE and SE. Enveloping segments work in pairs. ISA-IEA represents an interchange. GS-GE is a functional group inside of the interchange and ST-SE is a transaction inside the group.

EDI X12 850 sample


If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post