Table of Contents

EDIFACT Basics

EDIFACT (Electronic Data Interchange for Administration, Commerce and Transport) is an international standard for the electronic exchange of business data. It is maintained by UN/CEFACT (United Nations Centre for Trade Facilitation and Electronic Business) and is widely used worldwide, especially in Europe. EDIFACT defines message types for typical business processes such as purchase orders, invoices, or dispatch advices. This article describes the structure of the format and the most important terms.

The EDIFACT standard distinguishes between two categories of message types: Batch messages are created as files, transmitted, and processed by the recipient without both parties needing to be connected at the same time. Interactive messages (EDIFACT-I), on the other hand, are intended for real-time dialog communication, where requests and responses are exchanged within an ongoing session. In practice, almost exclusively batch messages are used.

Structure of an EDIFACT File

An EDIFACT file has a hierarchical structure. The levels from outermost to innermost are:

Interchange – The outermost envelope, comparable to a shipment or envelope. It is enclosed by the UNB (Interchange Header) and UNZ (Interchange Trailer) segments. It contains sender, recipient, date, and one or more messages.

Message – A single business message, comparable to a document (for example, a purchase order or invoice). It is enclosed by UNH (Message Header) and UNT (Message Trailer). Each message belongs to a specific message type (for example, ORDERS) and a version (for example, D96A).

Segment – A logical block within a message, comparable to a section of a document. Each segment begins with a three-character tag (for example, BGM for message header details, NAD for name and address, LIN for line item). Segments may be repeated individually or as part of a group.

Composite – A group of related data elements within a segment. Composites have four-character tags (for example, C082 for party identification). Not every segment contains composites.

Data Element – A single value, comparable to a field in a database. Data elements have four-digit numeric codes (for example, 1004 for document number). They have a data type (alphabetic, numeric, or alphanumeric) and a defined maximum length.

Control Characters

EDIFACT uses six control characters that define the file format. The standard values are:

Character Meaning Standard
Component Element Separator Separates data elements within a composite :
Element Separator Separates composites and data elements within a segment +
Decimal Notation Decimal separator .
Release Indicator Escape character used to include control characters as data values ?
Repetition Separator Separates repetitions of a data element *
Segment Terminator Ends a segment '

The control characters are defined in the optional UNA segment at the beginning of the file. The UNA segment contains no separators, but exactly six characters in a fixed order, for example UNA:+.?*'. If the UNA segment is missing, the standard values apply.

Tip

Some trading partners use different characters. It is therefore recommended to always include the UNA segment.

Important Segments

Segment Meaning
UNA Service String Advice – defines the control characters (optional)
UNB Interchange Header – sender, recipient, date, reference number
UNZ Interchange Trailer – number of messages in the interchange
UNG Group Header – groups messages of the same type (optional, rarely used)
UNE Group Trailer – ends a group
UNH Message Header – message type, version, and reference number
UNT Message Trailer – number of segments in the message
BGM Beginning of Message – document type and document number
DTM Date/Time/Period – date and time information
NAD Name and Address – addresses (buyer, supplier, delivery address)
LIN Line Item – start of a document line item
QTY Quantity – quantity information
MOA Monetary Amount – amounts
PRI Price Details – price information

The segments UNA, UNB, UNZ, UNH, and UNT are control segments and are present in every EDIFACT file. All other segments depend on the message type.

Versions and Message Types

EDIFACT versions follow the pattern DYYB, where D stands for Directory, YY indicates the year of publication, and B indicates the half-year release (A or B). Example: D96A stands for Directory 1996, Release A. The version identifier is specified in the UNH segment.

Common message types:

Type Meaning Typical Use
ORDERS Purchase Order Purchase order sent to the supplier
ORDRSP Order Response Supplier response to a purchase order
DESADV Dispatch Advice Advance notice of a shipment with package information
INVOIC Invoice Commercial invoice or credit note
PRICAT Price/Sales Catalog Item master data and prices
REMADV Remittance Advice Advance notice of a payment
CONTRL Acknowledgment Technical confirmation of message receipt

How to Read an EDIFACT File

An EDIFACT file is a continuous text stream in which the control characters define the structure. A simplified example:

UNA:+.?*'
UNB+UNOC:3+SENDER+RECEIVER+260328:1200+00001'
UNH+1+ORDERS:D:96A:UN'
BGM+220+PO-12345+9'
DTM+137:20260328:102'
UNT+4+1'
UNZ+1+00001'

This file is read as follows:

  • UNA:+.?*' – The six control characters in the standard order
  • UNB+UNOC:3+SENDER+RECEIVER+260328:1200+00001' – Interchange header: character set UNOC version 3, sender SENDER, recipient RECEIVER, date 2026-03-28 12:00, reference number 00001
  • UNH+1+ORDERS:D:96A:UN' – Message 1, type ORDERS, version D96A, organization UN
  • BGM+220+PO-12345+9' – Document type 220 (purchase order), document number PO-12345, function 9 (original)
  • DTM+137:20260328:102' – Date qualifier 137 (document date), value 20260328, format 102 (CCYYMMDD)
  • UNT+4+1' – End of message: 4 segments in message 1
  • UNZ+1+00001' – End of interchange: 1 message, reference number 00001

Within a segment, + separates elements, : separates sub-elements of a composite, and ' ends the segment.

EDIFACT in EDI Connect

Anvaigo EDI Connect supports all batch EDIFACT message types in all versions. A wizard is available for setting up EDIFACT mappings, which automatically generates the mapping structure from a sample file. Details about the configuration are described in the article The EDIFACT Converter. For the wizard, the EDIFACT Standard Data must be imported.