Document Structure
An X12 document is a file containing EDI data to be exchanged between trading partners.
An X12 document includes the following basic structures:
• Interchange
• Functional Group
• Transaction Set
The following sections provide a basic description of each of these structures. For more detailed information on each of these structures, see the X12 standard.
Interchange
The interchange is the basic unit of electronic data transfer. Several interchanges can be bundled into a single file for data transfer. An interchange starts with an interchange header (ISA segment), and ends with an interchange trailer (IEA segment).
Figure 40: Structure of X12 Interchange
In X12, the interchange header (ISA) performs the following functions:
-
Defines the delimiters used in the interchange.
-
Identifies the sender and receiver.
-
Provides control information for the interchange.
-
Allows for authorization and security information.
The following example of an X12 interchange contains an 850 (purchase order) transaction set:
ISA~00~Authorizat~00~Security I~01~123456789 ~01~987654321
~040418~1338~U~00403~000000001~0~I~+^
GS~PO~Application Sen~Application Rec~20040418~1338~1~X~004030^
ST~850~0001^
BEG~00~CO~PO#39281~Release Number~20040418^
REF~……….
N1~…………
PO1~……….
PO1~……….
. . .
CTT~……….
SE~70~0001^
GE~1~1^
IEA~1~000000001^
Functional Group
A functional group is a group of similar transaction sets, for example, three purchase orders.
It is a group of one or more related transaction sets sharing the same functional group ID. Functional groups start with the segment GS Functional Group Header, and end with the segment GE Functional Group Trailer.
The details in the Functional Group GS/GE envelope are often used to route the group transaction sets to the appropriate department or business application within a company.
Transaction Set
A transaction set contains the data for a well-defined business function. For example, X12 transaction sets can be used for purchase orders, invoices, and financial statements.
A business transaction is defined by a transaction set composed of a number of segments of variable lengths. Each segment is in turn composed of a number of data elements of variable lengths. A transaction set is analogous to a business document, such as a purchase order. A segment is analogous to a line of information in that purchase order. A data element is analogous to a unit of information in the item line. For example, in the purchase order for a book, the number of copies requested or the unit price is represented by data elements.
Transaction Set Header and Transaction Set Trailer
Each transaction set starts with a transaction set header (ST), followed by a beginning segment that uniquely identifies the type of transaction set. The transaction set header contains the transaction set identification and transaction set control number. The beginning segment is followed by other segments, which might also be found in other transaction sets, and is concluded by a transaction set trailer.
The transaction set trailer (SE) is the last element in the transaction set. It defines the end of the transaction set, and contains the number of segments included and the transaction set control number