ANSI X12 Explained: Message Standards and Transaction Sets
EDI has been the backbone of B2B transactions since the 1970s. However, many businesses still struggle to translate EDI standards from one standard to another.
Although only one of many EDI standards, the American National Standards Institute X12 (ANSI X12) is dominant in North America and used across the globe1. ANSI X12 is critical to understand and integrate into your EDI system.
Here, we will explain ANSI X12 transaction sets (T-Sets), syntax and message construction to provide you with the practical information you need to navigate the ANSI X12 standard with confidence.
What is ANSI X12?
The American National Standards Institute X12, known as ANSI X12, is an EDI standard introduced by The Accredited Standards Committee (ASC) in 1979.
The principle behind the ANSI X12 format is the same as all EDI standards: create a common language of codes and segments that can represent a wide range of business transactions across various industries. This provides uniformity for inter-industry electronic exchange of business documents in order to streamline transactions between trading partners.
ANSI X12 subcommittees
To handle the breadth of business processes covered by ANSI X12, the Accredited Standards Committee established subcommittees for different industry sectors. These include:
- X12C – Communications & Controls
- X12F – Finance
- X12I – Transportation
- X12J – Technical Assessment
- X12M – Supply Chain
- X12N – Insurance
These subcommittees cater to the unique requirements of different sectors, providing specific subsets of ANSI X12 for more precise communication.
Components of an ANSI X12 message
An ANSI X12 message is a structured set of data that represents a specific type of business transaction. Each message is built using a unique arrangement of codes, segments, and transaction sets (T-sets), which are unique but overlapping concepts.
- ANSI X12 Codes: These are unique identifiers that represent specific T-sets segments, or data elements in a message.
- ANSI X12 Segments: These are collections of related data elements that represent specific pieces of information in a transaction set. Each segment starts with a unique Segment ID, followed by the data elements separated by element separators.
- ANSI X12 T-sets: These are groups of related data segments that make up a particular business document or transaction. Each transaction set represents a different type of business document, such as an invoice or purchase order.
In ANSI X12, specifically, the terms T-set and message are often used interchangeably, and both refer to a collection of data that represents a single business document or transaction. However, T-sets can be defined more specifically as the type of business transaction that the message represents, while the message is the full representation of that business transaction.
ANSI X12 Code List
ANSI X12 has a wide range of codes used to denote specific message types that you need to understand in order to effectively construct an ANSI X12 message. The most common ANSI X12 codes are:
ANSI X12 Code | Description |
810 | Invoice |
820 | Payment Order |
830 | Delivery Forecast |
832 | Price/Sales Catalogue |
840 | Request for Quotation |
846 | Inventory Inquiry/Advice |
850 | Purchase Order |
852 | Product Activity Data |
855 | Purchase Order Acknowledgement |
856 | Ship Notice/Manifest |
860 | Purchase Order Change Request |
865 | Purchase Order Change Acknowledgement |
870 | Order Status Report |
997 | Functional Acknowledgement |
How ANSI X12 Messages are constructed
Constructing an ANSI X12 message entails assembling different key components in a structured, hierarchical manner using specific syntax. The components include data elements, segments, and transaction sets (T-sets), all of which are encapsulated within envelopes that structure the message. Here, we will dissect each component and illustrate their assembly into an ANSI X12 message.
Usable Characters: The language
Just like any language, ANSI X12 has a specific set of characters that can be used within messages. These include:
- Alphabetic characters: A to Z (uppercase only)
- Numeric characters: 0 to 9
- Special characters: A set of special characters, such as . , – ( ) / = + : ? ‘ and spaces
Together, these provide flexibility for communicating a full range of business transactions and information.
Data Elements: The fundamental units
Data elements are the smallest units of data in an ANSI X12 message. They represent individual pieces of business information. Data elements can be simple or composite:
- Simple Data Elements: These contain a single piece of information, akin to a word in a sentence. For instance, the price of a product or a specific date can be a simple data element.
- Composite Data Elements: These comprise multiple related pieces of information, similar to a sentence made up of related words. A complete address, which includes street name, city, state, and ZIP code, is an example of a composite data element.
There’s a unique ID for each data element along with its name, description, type, and minimum/maximum length. Data elements follow specific formats or types, such as decimal, integer, identifier, string, or date/time. The data dictionary will also list any restrictions or rules for the data element, such as whether it’s mandatory or optional, and if there are predefined values that it must adhere to.2
Segments: The building blocks
Segments in ANSI X12 are akin to sentences that offer a specific piece of information. Segments are an organised group of related data elements, with each segment beginning with a Segment ID.
Here’s an example:
Segment ID | Element Separator | Data Element 1 | Element Separator | Data Element 2 |
BEG | * | 00 | * | 082922 |
This ‘BEG’ (Beginning Segment) indicates the start of a purchase order, with ’00’ denoting an original document and ‘082922’ representing the purchase order number.
Crafting transaction sets (T-Set)
Transaction sets (T-sets) are akin to paragraphs, assembling related segments to represent a complete business transaction. Each transaction set is identified by a unique three-digit code.
Let’s construct a simplified example of a Purchase Order (PO) transaction set (identified by the code 850 in ANSI X12):
Segment ID | Data Elements |
ST | Transaction Set Identifier Code, Transaction Set Control Number |
BEG | Transaction Set Purpose Code, Purchase Order Number |
CUR | Currency Code |
REF | Reference Identification Qualifier, Reference Identification |
DTB | Date/Time Reference |
SE | Number of Included Segments, Transaction Set Control Number |
In this example, the ‘ST’ segment starts the transaction set, followed by segments like ‘BEG’ (beginning of the purchase order), ‘CUR’ (currency), and ‘REF’ (reference identification). This T-set ends with the ‘SE’ segment that includes the count of the total number of segments in the transaction set.
Envelopes: Grouping and structuring
Envelopes are the wrappers in an ANSI X12 interchange that group related data and structure the transaction sets. There are three types of envelopes:
- The Interchange Control Envelope (ISA and IEA) encapsulates the entire transmission, including all functional groups sent from a sender to a receiver.
- The Functional Group Envelope (GS and GE) groups related transaction sets. Different functional groups can be used to group different types of transaction sets or to separate transaction sets meant for different departments within the receiving organisation.
- The Transaction Set Envelope (ST and SE) encloses a single transaction set.
Complete Message: Pulling it all together
Let’s put it all together and look at a simplified representation of a complete ANSI X12 for a Purchase Order (850 Transaction Set) message:
Segment Code | Data Element | Description |
ISA | Interchange Sender/Receiver ID, Date, Time, etc. | Interchange Control Header (marks the start of the interchange envelope) |
GS | Functional Identifier Code (PO), Sender’s Code, Receiver’s Code, Date, Time | Functional Group Header (marks the start of the functional group) |
ST | 850 | Transaction Set Header (marks the start of the transaction set, 850 represents a Purchase Order) |
BEG | 00, 082922 | Beginning of the Purchase Order (00 stands for Original, and 082922 is the Purchase Order Number) |
CUR | USD | Currency Segment indicating USD (USD stands for U.S. Dollar) |
REF | AB, 12345 | Reference Segment with Additional Buyer Information (AB stands for Additional Buyer’s Number, and 12345 is the Reference Identification) |
DTM | 003, 20210910 | Date/Time Reference indicating the date (003 stands for Delivery Requested, and 20210910 is the date) |
SE | 5, 0001 | Transaction Set Trailer (marks the end of the transaction set, and 5 indicates the Number of Included Segments) |
GE | 1, 000000001 | Functional Group Trailer (marks the end of the functional group, and 1 represents the Number of Transaction Sets Included) |
IEA | 1, 000000001 | Interchange Control Trailer (marks the end of the interchange envelope, and 1 represents the Number of Included Functional Groups) |
In a real EDI message, this information would be formulated like this:
ISA00 00 ZZSENDERISA ZZRECEIVERISA2012091719U004010000000010P>~
GSPOSENDERCODERECEIVERCODE2012091719000000001X004010~
ST8500001~
BEG00082922~
CURUSD~
REFAB12345~
DTM00320210910~
SE50001~
GE1000000001~
IEA1*000000001~
In this instance, the * character is the data element separator, and the ~ character is the segment terminator, following common conventions in X12 syntax. Your specific implementation might use different characters as separators or terminators.
Transmission Files: Groups of messages
A transmission file in ANSI X12 refers to the entire collection of data that is sent from one trading partner to another at a given time. It’s essentially a batch of business documents structured according to the ANSI X12 standard. A transmission file could contain just a single message (like a single invoice or order), or it could contain many different messages. The key is that all the messages are transmitted together as a unit.
Leverage the strength of an EDI partner
ANSI X12 standard is a powerful and comprehensive system. However, it’s time-consuming to master, particularly for small to medium-sized businesses managing complex supply chains and multiple EDI standards. The challenge of accurately translating EDI formats like EDIFACT or TRADACOMS into ANSI X12, or vice versa, is significant without the right tools or assistance.
EDI via VAN (Value-Added Network) is a private network able to host tools like EDI mapping software that automate the translation of EDI messages from one standard to another. This is a critical capability for any business looking to flexibly engage with supply chain partners operating different, or multiple, EDI standards.
At Data Interchange, we provide flexible EDI services tailored to your business requirements. While it’s certainly possible to manually translate EDI message formats, we enable businesses to do so at speed and scale. With the right EDI partner it’s possible to be confident in your ability to match the requirements of supply chain partners. Get in touch to learn more.
2 ANSI/NISO Z39.87-2006 (R2017) Data Dictionary – Technical Metadata for Digital Still Images