EDI Examples: Real Message Samples

Learn from real-world EDI examples. This page contains sample EDIFACT and X12 messages with detailed explanations of each segment and element. Perfect for learning EDI structure or testing your integration.

Try it yourself: Copy any example below and paste it into our free EDIFACT Formatter to see it formatted with syntax highlighting.

Example 1: EDIFACT Purchase Order (ORDERS)

The ORDERS message is used to place an order for goods or services. This example shows a typical purchase order with two line items.

UNB+UNOA:2+BUYER123+SELLER456+240115:0930+REF001'
UNH+1+ORDERS:D:96A:UN'
BGM+220+PO-2024-001+9'
DTM+137:20240115:102'
DTM+2:20240130:102'
NAD+BY+5412345000016::9++ACME Corporation+123 Business Street+New York+NY+10001+US'
NAD+SU+4012345000094::9++Global Supplies Ltd+456 Supplier Road+Chicago+IL+60601+US'
CUX+2:USD:4'
LIN+1++9780123456789:EN'
PIA+1+WIDGET-A:SA'
IMD+F++:::Premium Widget Model A'
QTY+21:100'
PRI+AAA:25.99'
LIN+2++9780987654321:EN'
PIA+1+GADGET-B:SA'
IMD+F++:::Standard Gadget Model B'
QTY+21:50'
PRI+AAA:49.99'
UNS+S'
CNT+2:2'
UNT+18+1'
UNZ+1+REF001'

Segment Breakdown:

UNB - Interchange header: sender BUYER123, receiver SELLER456

UNH - Message header: ORDERS message, version D96A

BGM - Document type (220=blanket order) and reference number

DTM - Dates: order date (137) and requested delivery (2)

NAD+BY - Buyer name and address with GLN

NAD+SU - Supplier name and address

LIN - Line item with EAN/GTIN product code

QTY+21 - Ordered quantity

PRI+AAA - Price per unit

Example 2: EDIFACT Invoice (INVOIC)

The INVOIC message is sent by a supplier to bill for goods or services delivered.

UNB+UNOA:2+SELLER456+BUYER123+240120:1430+INV001'
UNH+1+INVOIC:D:96A:UN'
BGM+380+INV-2024-5678+9'
DTM+137:20240120:102'
DTM+35:20240115:102'
RFF+ON:PO-2024-001'
NAD+SE+4012345000094::9++Global Supplies Ltd'
NAD+BY+5412345000016::9++ACME Corporation'
CUX+2:USD:4'
LIN+1++9780123456789:EN'
QTY+47:100'
MOA+203:2599.00'
PRI+AAA:25.99'
TAX+7+VAT+++:::8+S'
LIN+2++9780987654321:EN'
QTY+47:50'
MOA+203:2499.50'
PRI+AAA:49.99'
TAX+7+VAT+++:::8+S'
UNS+S'
MOA+77:5098.50'
MOA+176:407.88'
MOA+79:5506.38'
UNT+23+1'
UNZ+1+INV001'

Key Elements:

BGM+380 - Commercial invoice document type

RFF+ON - Reference to original order number

MOA+203 - Line item amount

TAX+7+VAT - VAT tax at 8%

MOA+77 - Invoice total excluding tax

MOA+176 - Total tax amount

MOA+79 - Grand total including tax

Example 3: EDIFACT Despatch Advice (DESADV)

The DESADV message notifies the buyer that goods have been shipped. Also known as Advance Shipping Notice (ASN).

UNB+UNOA:2+SELLER456+BUYER123+240118:0800+DSP001'
UNH+1+DESADV:D:96A:UN'
BGM+351+SHIP-2024-789+9'
DTM+137:20240118:102'
DTM+11:20240120:102'
RFF+ON:PO-2024-001'
NAD+CZ+4012345000094::9++Global Supplies Ltd'
NAD+CN+5412345000016::9++ACME Corporation+123 Business Street+New York+NY+10001'
TDT+20+123456+++UPS:::United Parcel Service'
EQD+CT+CONT123456'
CPS+1'
PAC+2++CT'
PCI+33E+1Z999AA10123456784'
LIN+1++9780123456789:EN'
QTY+12:100'
CPS+2'
PAC+1++CT'
PCI+33E+1Z999AA10123456785'
LIN+2++9780987654321:EN'
QTY+12:50'
CNT+2:2'
UNT+21+1'
UNZ+1+DSP001'

Key Elements:

BGM+351 - Despatch advice document type

DTM+11 - Estimated delivery date

TDT+20 - Transport details with carrier info

CPS - Consignment packing sequence

PAC - Package type (CT = carton)

PCI+33E - Tracking number / SSCC

Example 4: EDIFACT Order Response (ORDRSP)

The ORDRSP confirms receipt and acceptance of an order, possibly with modifications.

UNB+UNOA:2+SELLER456+BUYER123+240116:1000+RSP001'
UNH+1+ORDRSP:D:96A:UN'
BGM+231+RESP-2024-001+4'
DTM+137:20240116:102'
RFF+ON:PO-2024-001'
NAD+SE+4012345000094::9++Global Supplies Ltd'
NAD+BY+5412345000016::9++ACME Corporation'
LIN+1+5+9780123456789:EN'
QTY+21:100'
DTM+2:20240130:102'
LIN+2+3+9780987654321:EN'
QTY+21:30'
DTM+2:20240205:102'
UNS+S'
UNT+13+1'
UNZ+1+RSP001'

Key Elements:

BGM+231 - Order response document

LIN+1+5 - Line 1 accepted (5=accepted)

LIN+2+3 - Line 2 changed (3=change), quantity reduced to 30

Example 5: Minimal EDIFACT Message

A minimal EDIFACT interchange showing the basic required structure.

UNB+UNOA:2+SENDER+RECEIVER+240101:1200+1'
UNH+1+ORDERS:D:96A:UN'
BGM+220+TEST123+9'
UNT+3+1'
UNZ+1+1'

Structure Explained:

UNB...UNZ - Interchange envelope (required)

UNH...UNT - Message envelope (required)

BGM - Beginning of message (required for most messages)

Download Sample Files

Copy any of the examples above to test with your EDI software. All examples follow EDIFACT syntax version D96A, which is widely supported.

  • Examples use standard UNOA character set (A-Z, 0-9, basic punctuation)
  • All segment terminators are apostrophe (')
  • Data element separator is plus (+)
  • Component separator is colon (:)

Related Resources

Format Your EDI Messages

Paste any EDI message into our free formatter to see it with proper formatting and color-coded segments.

Try EDIFACT Formatter →