Lesson 3 of 5
UN/EDIFACT anatomy
9 min
Listen to this lesson
UN/EDIFACT is the international counterpart to X12, maintained under the United Nations (UN/CEFACT) and dominant in Europe, much of Asia, and in global automotive and logistics. Contoso trades only in X12 today, but the moment it sells to a European distributor or joins a global OEM program it will meet EDIFACT. So this lesson uses a what-if: a European aftermarket distributor sends Contoso an EDIFACT purchase order for 20 alternators.
UNA:+.? 'UNB+UNOC:3+EUDISTRIB:ZZ+CONTOSOMC:ZZ+261014:0915+4402++ORDERS++1'UNH+1+ORDERS:D:96A:UN'BGM+220+EU-7730+9'DTM+137:20261014:102'DTM+2:20261028:102'NAD+BY+EUDISTRIB::92'NAD+SU+CONTOSOMC::92'LIN+1++CMC-ALT-100:SA'QTY+21:20'PRI+AAA:250.00'UNS+S'CNT+2:1'UNT+12+1'UNZ+1+4402'
Service characters and the UNA string
EDIFACT also uses delimiters, but its defaults are different and they are declared in an optional UNA service string advice at the very start: UNA:+.? '. Read it character by character:
| Position | Character | Role |
|---|---|---|
| 1 | : | Component data element separator |
| 2 | + | Data element separator |
| 3 | . | Decimal notation |
| 4 | ? | Release (escape) character, so ?+ means a literal plus sign |
| 5 | space | Reserved (repetition separator in syntax version 4) |
| 6 | ' | Segment terminator |
The six characters of the UNA service string advice.
If UNA is missing, the defaults apply. The release character is a classic source of bugs: a company name like "Smith+Sons" must be sent as Smith?+Sons, or the receiver splits it into two elements.
Envelopes
| Level | X12 | EDIFACT | Notes |
|---|---|---|---|
| Delimiter declaration | Inside ISA | UNA (optional) | EDIFACT defaults apply when UNA is absent |
| Interchange | ISA ... IEA | UNB ... UNZ | Sender, receiver, date and time, control reference |
| Group | GS ... GE (mandatory) | UNG ... UNE (optional, rarely used) | Most EDIFACT interchanges skip groups |
| Message | ST ... SE | UNH ... UNT | UNT carries the segment count and repeats the message reference |
The UNB interchange header names the syntax identifier and version (UNOC:3: character set level C, syntax version 3), the sender and recipient IDs with their code qualifiers, the preparation date and time, and the interchange control reference (here 4402), which UNZ repeats. The ninth element of UNB, set to 1 in the sample, is the acknowledgment request: the sender asks for a CONTRL message back.
The syntax identifier matters more than it looks. UNOA and UNOB are restricted character sets (UNOA is uppercase only), while UNOC covers the Latin-1 range with accented letters, which European partners need for names and addresses. Syntax version 3 is still the most common; version 4 adds features such as the repetition separator in UNA position 5 and is used by newer implementations. If a partner sends UNOA and Contoso's outbound map writes lowercase customer names, the partner's translator may reject the reply, so the character set belongs in the partner checklist.
The UNH message header is where EDIFACT names the business document: ORDERS:D:96A:UN means message type ORDERS, from directory D.96A, controlled by the UN. That directory version is the EDIFACT counterpart of the X12 version number. The UN publishes directories twice a year (D.96A, D.01B, D.21A and so on), and partners agree on one. D.96A and D.01B remain very common in automotive and retail.
Reading the ORDERS body
| Segment | In the sample | Meaning |
|---|---|---|
BGM | 220+EU-7730+9 | Beginning of message: document name code 220 (order), the buyer's order number, message function 9 (original) |
DTM | 137:20261014:102 and 2:20261028:102 | Qualifier 137 = document date, 2 = delivery date requested; format 102 = CCYYMMDD |
NAD | BY, SU | Name and address: BY buyer, SU supplier (DP would be the delivery party) |
LIN | 1++CMC-ALT-100:SA | Line 1, item number with type SA (supplier's article number) |
QTY and PRI | 21:20 and AAA:250.00 | Qualifier 21 = ordered quantity; AAA = net calculation price |
UNS and CNT | S and 2:1 | Section control between detail and summary; control total 2 = number of line items |
The business content of the what-if EDIFACT ORDERS message.
X12 and EDIFACT side by side
The two standards carry the same business meaning with different vocabulary. An X12 850 BEG becomes an EDIFACT BGM with code 220; DTM exists in both but with different qualifier code lists; N1 becomes NAD; PO1 becomes a LIN group with QTY and PRI. Neither standard is better. What matters is which one the partner uses and which directory or version is in its guide.
What would you do?
The European distributor's test file reaches PO, but the translator rejects it: the NAD segment for the buyer has one element too many. The company name in the file is <code>BRAKE+FLEET GMBH</code>. What is the most likely cause?
- EDIFACT declares its delimiters in the optional UNA string; the release character ? escapes delimiter characters in data.
- UNB/UNZ wrap the interchange, UNG/UNE optionally wrap groups, and UNH/UNT wrap each message.
- UNH names the message type and directory, such as ORDERS:D:96A:UN; partners agree on the directory.
- X12 dominates North America, EDIFACT dominates Europe and global trade, and industry subsets such as EANCOM add rules.
Check your understanding · not graded
Lesson check
1. In <code>UNH+1+ORDERS:D:96A:UN</code>, what does <code>D:96A</code> identify?
2. What is the role of the <code>?</code> character in the default EDIFACT service characters?
3. Which EDIFACT envelope level is optional and rarely used, unlike its X12 counterpart?