Back to the blog
Basics12 March 20266 min readAndreas Pörtner

Reading your first EDIFACT file without a manual

A short walkthrough of an ORDERS message, segment by segment, so the wall of apostrophes turns into a purchase order.

Start at the envelope

The first segment tells you who is talking to whom. UNB carries the syntax identifier, sender, receiver, date, time and a control reference that the closing UNZ must repeat.

UNB+UNOC:3+4012345000009:14+4000004000002:14+260312:1043+100001'

Then the message header

UNH names the message type and the directory: ORDERS in directory D, release 96A, agency UN. Without the directory the segment names are ambiguous, so this line decides how everything below is interpreted.

UNH+1+ORDERS:D:96A:UN:EAN008'

Business content in three families

Almost every segment you meet belongs to one of three groups: what the document is (BGM, DTM), who is involved (NAD, RFF, CTA) and what is ordered (LIN, IMD, QTY, PRI, MOA).

  • BGM+220 — this is a purchase order, original.
  • DTM+137 — document date, format 102 means CCYYMMDD.
  • NAD+BY — buyer, identified by a GLN when the qualifier is 9.
  • LIN+1++4012345678901:EN — line one, EAN article number.
  • QTY+21:480:PCE — ordered quantity, 480 pieces.

Finish with the counts

UNT repeats the message reference and counts the segments of the message. UNZ repeats the interchange control reference and counts the messages. If either number is wrong the partner's system rejects the file before a human ever sees it.

Try it on your own document

Upload an EDIFACT, X12 or XML file and see structure, validation findings and a plain-language explanation in one view.

Analyze a document