VDA EDI Tools

UNA, UNB and UNH: The EDIFACT Envelope, Field by Field

VDA EDI Tools Blog · 2026-11-16

Every EDIFACT parser reads the same three segments before it reads anything else: UNA tells it which characters separate the data, UNB tells it who is talking to whom, and UNH tells it what kind of message follows. Get those three right and the rest is bookkeeping. Get one wrong and no content validation will ever run, because the file is unreadable. Here is each field, in order, with the failure modes that actually appear in production traffic.

UNA: the six characters that define the alphabet

UNA is the service string advice, and it is exactly nine characters long: the letters UNA followed by six separator definitions. A classic one looks like this:

UNA:+.? '

The positions matter more than the characters, because this line is a lookup table the parser applies to every byte that follows:

PositionCharacterMeaning
1:Component data element separator (inside composites)
2+Data element separator (between elements in a segment)
3.Decimal notation
4?Release character (escapes the separators inside data)
5 (space)Reserved; from syntax version 4 onwards it is the repetition separator
6'Segment terminator

Two things trip people up here. First, UNA is optional. When it is missing, the defaults apply (+ for elements, : for components, ? for release, apostrophe to terminate), which is why files with no UNA line at all still parse fine. Second, once a UNA line exists, it wins. Files exported with a UNA that says : is the component separator but built elsewhere with + in that role split into garbage exactly halfway through the first segment. Our segment terminator article goes deeper on the byte level, including what carriage returns do to naive parsers.

UNB: who sent this, and under which rules

UNB is the interchange header. It carries the syntax version both sides agreed on, both parties' addresses, and the control reference everything else hangs off. A typical automotive interchange opens like this:

UNB+UNOB:4+SENDEROID::OD+RECEIVEROID::OD+20261116:0930+493800001++DESADV'

Field by field:

One more element worth knowing: 0035, the test indicator. When it carries 1, the whole interchange is a test. Files that go live with 0035 set to 1 get accepted in test environments and rejected in production, and the error message rarely says why.

UNH: what message is this, exactly

UNH opens every individual message inside the interchange and answers the question the mapper actually cares about:

UNH+1+DESADV:D:96A:UN'

The version and release pair is the one that hurts when it is wrong. D:96A is the common baseline for the VDA 49xx automotive profiles; a file that announces D:01B tells the receiver to expect element definitions from a different directory, and field lengths or codes that were fine in 96A suddenly fail schema checks that have nothing to do with your data.

A complete miniature interchange

Put it together and a one-message interchange looks like this:

UNA:+.? '
UNB+UNOB:4+SENDEROID::OD+RECEIVEROID::OD+20261116:0930+493800001++DESADV'
UNH+1+DESADV:D:96A:UN'
BGM+351+12345'
DTM+137:20261116:102'
...
UNT+12+1'
UNZ+1+493800001'

Three numbers must agree or the file dies: UNT's segment count must equal the real number of segments in the message (counting UNH and UNT themselves), UNT's reference must equal UNH's 0062, and UNZ must carry the same interchange count as UNB expects plus the same control reference 0020. Our envelope error article walks through what each of those mismatches looks like when it arrives from a partner.

The three envelope bugs we see most

  1. UNA disagrees with the file. Exported twice, edited once, concatenated never. The UNA says one alphabet, the body uses another.
  2. Sender and receiver swapped. In a self-billing setup the OEM is the sender, so UNB's S002 and S003 feel backwards to teams used to outbound files. The message is still correct; the surprise is.
  3. Control references reused. A counter that resets daily or per file template produces duplicate 0020 values, and the receiver's duplicate filter silently drops real files. Give each interchange a reference that cannot collide.

The envelope rules above are the same ones our validators enforce on every paste. If a partner file fails before it even reaches the content checks, the VDA 4987 validator and the VDA 4984 validator will tell you exactly which of these fields is out of line, in your browser, before your customer's gateway does.

Try it: Paste a partner file and check the UNA/UNB/UNH envelope plus segment counts locally. Open the tool →

Related reading: EDIFACT basics in 10 minutes and UNB, UNH, UNT, UNZ errors that break the whole file.

← All articles