# EDIFACT Segment Tags, BGM Codes and NAD Qualifiers

> Source: https://netray.co/tools/edifact-segment-and-bgm-code-reference
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Look up what a UN/EDIFACT segment tag or document code means when reading ORDERS, DESADV or INVOIC files.

## Category

supply-chain

## Audience

- EDI coordinator
- EDI analyst
- ERP integration developer

## Tool

**Kind:** worksheet

**Mode:** reference

**Columns:**

#### Group

**Key:** group

**Type:** text

#### Tag or code

**Key:** code

**Type:** text

#### Name

**Key:** name

**Type:** text

#### Use

**Key:** note

**Type:** text

**Rows:**

#### Service string advice

**Group:** Service

**Code:** UNA

**Note:** Optional. Declares separators and release character at the start of the interchange.

#### Interchange header

**Group:** Service

**Code:** UNB

**Note:** Syntax identifier, sender, recipient, date and time, interchange reference.

#### Interchange trailer

**Group:** Service

**Code:** UNZ

**Note:** Count of messages and the interchange control reference.

#### Functional group header

**Group:** Service

**Code:** UNG

**Note:** Optional group envelope. Many implementations skip it.

#### Functional group trailer

**Group:** Service

**Code:** UNE

**Note:** Closes the UNG group.

#### Message header

**Group:** Service

**Code:** UNH

**Note:** Message reference, message type (ORDERS), version and release (D96A, D01B).

#### Message trailer

**Group:** Service

**Code:** UNT

**Note:** Count of segments including UNH and UNT, plus message reference.

#### Section control

**Group:** Service

**Code:** UNS

**Note:** Separates the detail and summary sections. UNS+S is the usual form.

#### Syntax and service report message

**Group:** Service

**Code:** CONTRL

**Note:** Acknowledgment of syntax acceptance, similar in purpose to a 997.

#### Beginning of message

**Group:** Data

**Code:** BGM

**Note:** Document name code, document number, message function.

#### Date, time, period

**Group:** Data

**Code:** DTM

**Note:** Qualifier 137 is document date, 2 delivery date requested, 11 despatch date.

#### Name and address

**Group:** Data

**Code:** NAD

**Note:** Party qualifier then party identification.

#### Reference

**Group:** Data

**Code:** RFF

**Note:** Qualifier ON is order number, DQ delivery note number, IV invoice number.

#### Line item

**Group:** Data

**Code:** LIN

**Note:** Line number and item number with EN for EAN.

#### Additional product id

**Group:** Data

**Code:** PIA

**Note:** Supplier or buyer item codes (qualifier 5 product id, SA supplier's article number).

#### Item description

**Group:** Data

**Code:** IMD

**Note:** Free form or coded description.

#### Quantity

**Group:** Data

**Code:** QTY

**Note:** Qualifier 21 ordered, 12 despatched, 47 invoiced.

#### Price details

**Group:** Data

**Code:** PRI

**Note:** Qualifier AAA is net price, AAB gross price.

#### Monetary amount

**Group:** Data

**Code:** MOA

**Note:** Qualifier 203 line amount, 77 invoice total, 125 taxable amount.

#### Duty, tax and fee details

**Group:** Data

**Code:** TAX

**Note:** Tax type (VAT), category code and rate.

#### Currencies

**Group:** Data

**Code:** CUX

**Note:** Reference and target currencies using ISO 4217 codes.

#### Payment terms basis

**Group:** Data

**Code:** PAT

**Note:** Payment terms type with time reference.

#### Allowance or charge

**Group:** Data

**Code:** ALC

**Note:** A for allowance, C for charge, then qualifiers and amounts.

#### Place or location identification

**Group:** Data

**Code:** LOC

**Note:** Qualifier 7 place of delivery, 11 place of discharge.

#### Consignment packing sequence

**Group:** Data

**Code:** CPS

**Note:** Hierarchy of the pack in DESADV.

#### Package

**Group:** Data

**Code:** PAC

**Note:** Number and type of packages.

#### Package identification

**Group:** Data

**Code:** PCI

**Note:** Marks and labels on packages.

#### Goods identity number

**Group:** Data

**Code:** GIN

**Note:** Serial shipping container code (SSCC) with qualifier BJ.

#### Measurements

**Group:** Data

**Code:** MEA

**Note:** Weight, volume, length.

#### Details of transport

**Group:** Data

**Code:** TDT

**Note:** Carrier and mode of transport.

#### Free text

**Group:** Data

**Code:** FTX

**Note:** Notes by qualifier such as AAI general information.

#### Order

**Group:** BGM 1001

**Code:** 220

**Note:** Purchase order in ORDERS.

#### Purchase order response

**Group:** BGM 1001

**Code:** 231

**Note:** Used in ORDRSP.

#### Despatch advice

**Group:** BGM 1001

**Code:** 351

**Note:** Used in DESADV.

#### Commercial invoice

**Group:** BGM 1001

**Code:** 380

**Note:** Used in INVOIC.

#### Credit note

**Group:** BGM 1001

**Code:** 381

**Note:** Used in INVOIC to credit a prior invoice.

#### Debit note

**Group:** BGM 1001

**Code:** 383

**Note:** Used in INVOIC to increase a prior invoice.

#### Original

**Group:** BGM 1225

**Code:** 9

**Note:** First transmission of the document.

#### Replace

**Group:** BGM 1225

**Code:** 5

**Note:** Replaces a previously sent document.

#### Cancellation

**Group:** BGM 1225

**Code:** 1

**Note:** Cancels a previously sent document.

#### Buyer

**Group:** NAD 3035

**Code:** BY

**Note:** Party placing the order.

#### Supplier

**Group:** NAD 3035

**Code:** SU

**Note:** Party supplying the goods.

#### Delivery party

**Group:** NAD 3035

**Code:** DP

**Note:** Ship-to location.

#### Invoicee

**Group:** NAD 3035

**Code:** IV

**Note:** Party being invoiced.

#### Seller

**Group:** NAD 3035

**Code:** SE

**Note:** Party selling the goods.

**Notes:** 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.

## Content

**Intro:** 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.

**Sections:**

#### How to read an EDIFACT message

**Body:** 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

**Body:** 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.

**Bullets:**

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

#### Common mistakes

**Body:** 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.

**Cta:** 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.

**Faq:**

#### What is the difference between ORDERS and ORDRSP?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

edifact segment list, edifact BGM document codes, edifact NAD qualifiers, edifact UNH UNT UNB UNZ, edifact 220 351 380 codes, edifact segment tags explained, edifact LIN QTY PRI MOA, edifact segment reference

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
