Supply Chain & InventoryFree referencePDF, Excel, Word export

EDIFACT Segment Tags, BGM Codes and NAD Qualifiers

UN/EDIFACT messages are made of short three letter segments separated by plus signs, which makes them hard to read at first. This reference explains the segment tags and the codes that tell you which kind of document you have.

Download:
GroupTag or codeNameUse
Service
UNA
Service string advice
Optional. Declares separators and release character at the start of the interchange.
Service
UNB
Interchange header
Syntax identifier, sender, recipient, date and time, interchange reference.
Service
UNZ
Interchange trailer
Count of messages and the interchange control reference.
Service
UNG
Functional group header
Optional group envelope. Many implementations skip it.
Service
UNE
Functional group trailer
Closes the UNG group.
Service
UNH
Message header
Message reference, message type (ORDERS), version and release (D96A, D01B).
Service
UNT
Message trailer
Count of segments including UNH and UNT, plus message reference.
Service
UNS
Section control
Separates the detail and summary sections. UNS+S is the usual form.
Service
CONTRL
Syntax and service report message
Acknowledgment of syntax acceptance, similar in purpose to a 997.
Data
BGM
Beginning of message
Document name code, document number, message function.
Data
DTM
Date, time, period
Qualifier 137 is document date, 2 delivery date requested, 11 despatch date.
Data
NAD
Name and address
Party qualifier then party identification.
Data
RFF
Reference
Qualifier ON is order number, DQ delivery note number, IV invoice number.
Data
LIN
Line item
Line number and item number with EN for EAN.
Data
PIA
Additional product id
Supplier or buyer item codes (qualifier 5 product id, SA supplier's article number).
Data
IMD
Item description
Free form or coded description.
Data
QTY
Quantity
Qualifier 21 ordered, 12 despatched, 47 invoiced.
Data
PRI
Price details
Qualifier AAA is net price, AAB gross price.
Data
MOA
Monetary amount
Qualifier 203 line amount, 77 invoice total, 125 taxable amount.
Data
TAX
Duty, tax and fee details
Tax type (VAT), category code and rate.
Data
CUX
Currencies
Reference and target currencies using ISO 4217 codes.
Data
PAT
Payment terms basis
Payment terms type with time reference.
Data
ALC
Allowance or charge
A for allowance, C for charge, then qualifiers and amounts.
Data
LOC
Place or location identification
Qualifier 7 place of delivery, 11 place of discharge.
Data
CPS
Consignment packing sequence
Hierarchy of the pack in DESADV.
Data
PAC
Package
Number and type of packages.
Data
PCI
Package identification
Marks and labels on packages.
Data
GIN
Goods identity number
Serial shipping container code (SSCC) with qualifier BJ.
Data
MEA
Measurements
Weight, volume, length.
Data
TDT
Details of transport
Carrier and mode of transport.
Data
FTX
Free text
Notes by qualifier such as AAI general information.
BGM 1001
220
Order
Purchase order in ORDERS.
BGM 1001
231
Purchase order response
Used in ORDRSP.
BGM 1001
351
Despatch advice
Used in DESADV.
BGM 1001
380
Commercial invoice
Used in INVOIC.
BGM 1001
381
Credit note
Used in INVOIC to credit a prior invoice.
BGM 1001
383
Debit note
Used in INVOIC to increase a prior invoice.
BGM 1225
9
Original
First transmission of the document.
BGM 1225
5
Replace
Replaces a previously sent document.
BGM 1225
1
Cancellation
Cancels a previously sent document.
NAD 3035
BY
Buyer
Party placing the order.
NAD 3035
SU
Supplier
Party supplying the goods.
NAD 3035
DP
Delivery party
Ship-to location.
NAD 3035
IV
Invoicee
Party being invoiced.
NAD 3035
SE
Seller
Party selling the goods.

EDIFACT directories change between releases (D96A, D01B and others). Codes shown are widely used, but always check the message implementation guide and the directory version in the UNH segment.

Plain language view of EDIFACT traffic

An optional review of how EDIFACT messages could be summarized for non-technical staff.

Optional. The tool and every export work without this. No spam.

How to read an EDIFACT message

A file starts with UNB and ends with UNZ. Each message sits between UNH and UNT. The UNH tells you the message type and directory version, for example ORDERS:D:96A:UN. Inside, BGM identifies the document (220 for an order, 351 for a despatch advice, 380 for an invoice), and the rest is a sequence of segments: DTM for dates, NAD for parties, LIN for each line, QTY and PRI for numbers.

Separators and release characters

The default separators are a colon between components, a plus sign between elements, an apostrophe as the segment terminator and a question mark as the release character that escapes the others. The optional UNA segment declares them. When a description contains a plus sign or an apostrophe, the sender must put a question mark in front of it, otherwise the parser splits the value.

  • Component separator: colon.
  • Data element separator: plus.
  • Segment terminator: apostrophe.
  • Release character: question mark.

Common mistakes

The most common errors are an incorrect segment count in UNT, which must include UNH and UNT themselves, and a mismatch between UNH and UNT message reference numbers. Mixing up directory versions is another: a D96A map sent to a partner expecting D01B may be rejected because of changed code lists. Always test with the partner's validation tool before production.

Frequently Asked Questions

What is the difference between ORDERS and ORDRSP?

ORDERS is the purchase order message sent by the buyer. ORDRSP is the purchase order response sent by the supplier to confirm, change or reject. They map roughly to X12 850 and 855.

Does UNT count UNH?

Yes. The segment count in UNT includes both UNH and UNT. A message with UNH, BGM, DTM and UNT has a count of 4.

What is DESADV?

DESADV is the despatch advice, the EDIFACT equivalent of an advance ship notice (X12 856). It uses BGM 351 and CPS segments to show the packaging hierarchy.

How do I escape a plus sign in text?

Put the release character, normally a question mark, in front of it. For example, 'A?+B' carries the text A+B. The same applies to colons, apostrophes and the question mark itself.

Netray can help build read-only views of EDIFACT traffic in plain language for the EDI desk, showing the order, delivery date and quantity without needing to parse segments by eye.