A segment in an EDI transaction set is a group of like data elements.
If you were filling out information on a purchase order, you would expect to see groups of related data. For example, look at the diagram below of a paper purchase order in which only one item is being ordered. Note that there are four sections, each providing a different set of information:
In an EDI document, each section is described by a particular segment. Below is the set of EDI segments that would describe the purchase order above when using the EDIFACT standard. Each segment begins with a 3-character code (e.g. UNH, BGM, DTM, NAD, LIN, QTY,PRI, UNS, CNT, UNT) that describes the type of data elements that follows. The elements within each segment are separated by a data element separator, in this case the ‘+’. The segment is ended by a segment terminator, normally, the apostrophe (‘).
|UNH+SSDD1+ORDERS:D:03B:UN:EAN008′||UNH, to indicate start of message – in this case ORDERS|
|BGM+220+4768+9′||BGM, to indicate the beginning of the PO message|
|DTM+137:20120930:102′||DTM, to indicate the date/time period|
|NAD+BY+5412345000176::9′||NAD, to identify the buyer code corresponding to the name/address|
|LIN+1+1+331896-42:VN’||LIN, to describe line item detail|
|QTY+1:100:EA’||QTY, to define the quantity|
|PRI+AAA:27.65′||PRI, to define price|
|UNS+S’||UNS, section control segment to separate line item detail from summary information|
|CNT+2:1′||CNT, to provide the number of line items|
|UNT+22+SSDD1′||UNT, to indicate the end of the PO|
For each type of business document, the EDI standard documentation defines:
- The segments that may be included and which ones are mandatory, optional and/or conditional (i.e. must be included only if another segment or element is included)
- For each segment, the elements that may be included – for every piece of information in a paper document there is a corresponding EDI element. These elements are defined in the standards dictionary and each standard has its own dictionary
- The required sequence of the segments and elements
- How many times a segment may be repeated
Now, once all the segments are collected into a prescribed sequence, they form a complete electronic document, or transaction set. Next, the transaction sets must be put into envelopes in preparation for transmission to your partners.
Read about envelopes »