The invoice file is the TRADACOMS document that gets you paid, and the one retailers check hardest. Every line, every VAT sub-total and every file total has to add up, and the numbers have no decimal points. A file that fails those checks is usually rejected rather than queried, and the invoice is not paid until a corrected file arrives.
This guide covers the four messages in an INVFIL, how the VAT arithmetic chains from line to file, and two live examples. For the EANCOM equivalent, see the EDIFACT INVOIC guide.
What is a TRADACOMS INVFIL?
INVFIL is the invoice file in TRADACOMS, the UK retail EDI standard maintained by the Article Numbering Association, now GS1 UK, until support ended in 2017. The supplier sends it to the customer to bill for goods or services. One file can carry a single invoice or a whole day's invoicing to that customer.
Unlike the order file, the invoice file has two trailer messages. VATTLR summarises VAT by rate across every invoice in the file, and INVTLR gives the file totals. That structure reflects the standard's UK design: VAT is built into the file, rate by rate, at every level.
INVFIL file structure
STX Start of transmission (supplier to customer, APRF INVFIL)
│
├── MHD INVFIL Invoice file header once per file
│ TYP SDT CDT FIL (DNA FDT ACD)
│ MTR
│
├── MHD INVOIC Invoice details once per invoice, repeats
│ CLO IRF (PYT DNA)
│ ODD order and delivery reference
│ ILD ILD ... one per invoice line
│ STL STL ... one per VAT rate on this invoice
│ TLR invoice totals
│ MTR
│
├── MHD VATTLR VAT trailer once per file
│ VRS VRS ... one per VAT rate in the file
│ MTR
│
├── MHD INVTLR Invoice file trailer once per file
│ TOT file totals and invoice count
│ MTR
│
END End of transmission (number of messages)
The VATTLR and INVTLR come once, after all the invoices. A translator that writes a VATTLR after every INVOIC produces a file the customer's system does not expect; a Software AG community thread describes exactly that mistake.
Example: one invoice, one VAT rate
Kestrel Valley Homeware invoices fictional retailer Harbour Lane Stores for the order it delivered to Harbour Lane's northern DC: 40 cases of chopping boards, 20 cases of mill sets and 10 cases of utensil sets, all standard-rated. Identifiers are made up, with valid GS1 check digits.
INVFIL file with one invoice
Invoice file header, one INVOIC with three ILD lines and one STL sub-trailer at 20%, then the VATTLR and INVTLR trailers. Amounts use implied decimals.
INVFIL · Invoice file header · ref 1
Parties
| Role | Identifier | Name and address |
|---|---|---|
| Supplier SDT | 5098765000002GS1 GLN | KESTREL VALLEY HOMEWARE LTD |
| Customer CDT | 5012345000008GS1 GLN | HARBOUR LANE STORES LTD |
INVOIC · Invoice · ref 2
- Document
- Invoice
- Document number
- KV-INV-20931
- Invoice date
- 2026-10-16
Parties
| Role | Identifier | Name and address |
|---|---|---|
| Delivery location CLO | 5012345000107GS1 GLN | HARBOUR LANE NORTHERN DC |
Lines (3)
| # | GTIN | Codes | Description | Qty | Price | Amount |
|---|---|---|---|---|---|---|
| 1.1 | - | - | - | - | - | - |
| 1.2 | - | - | - | - | - | - |
| 1.3 | - | - | - | - | - | - |
VATTLR · VAT trailer · ref 3
INVTLR · Invoice file trailer · ref 4
Transmission (STX)
- Sender
- KESTREL VALLEY HOMEWAREcode 5098765000002
- Recipient
- HARBOUR LANE STORES LTDcode 5012345000008
- Prepared
- 2026-10-16 17:05:00
- Control reference
- KV0000318
- Syntax
- ANA:1
- Messages
- 4
| Segment | What it says |
|---|---|
STX=...+INVFIL+B' | Supplier to customer; application reference INVFIL |
MHD=1+INVFIL:9' | Message 1 is the invoice file header, version 9 |
TYP=0700+INVOICES' | Transaction code 0700: invoices only |
SDT=...++987654321' | Supplier GLN, supplier number at the retailer, name, (no address), VAT registration number |
FIL=1207+1+261016' | File generation number 1207, version 1, created 16 October 2026 |
CLO=5012345000107:00212+... | The delivery location being invoiced |
IRF=KV-INV-20931+261016+261016' | Invoice number, invoice date and tax point date |
ODD=1+HL-PO-88340::261012+KV-DN-55120:261015' | The retailer's order number and date, and your delivery note number and date |
ILD=1+1+... | Invoice line 1 under order and delivery reference 1 (broken down below) |
STL=1+S+20000+3+71000... | VAT sub-trailer: standard rate, 20%, 3 lines, £710.00 net, £142.00 VAT, £852.00 payable |
TLR=1+71000... | Invoice totals across one STL |
MTR=10' | Ten segments in the INVOIC message |
VRS=1+S+20000+... | VAT rate summary for the whole file |
TOT=71000+71000+14200+85200+85200+1' | File totals: net, net after discount, VAT, payable before and after discount, and 1 invoice |
END=4' | Four messages |
Implied decimals: reading the numbers
Nothing in an INVFIL has a decimal point. Each numeric field has a fixed number of implied decimal places set by the specification. The John Lewis Partnership publishes the formats it uses, and they match how the example above is written:
| Field | Format in the JLP spec | Example value | Means |
|---|---|---|---|
AUCT unit cost price | n10.4 | 90000 | £9.0000 |
LEXC extended line cost | n10.4 | 3600000 | £360.0000 |
VATP VAT percentage | n3.3 | 20000 | 20.000% |
LVLA, VATA and other STL, TLR, VRS and TOT amounts | n10.2 | 71000 | £710.00 |
Line values carry four decimal places and totals two, so the move from LEXC to LVLA is where you round. Sum the line values first, then round the sub-total; rounding each line separately can leave the STL a penny out. Confirm the formats in your own partner's specification before you build.
Segment reference
Version 9 layouts. "M" is mandatory and "O" optional in the standard. The EANCOM column gives the closest equivalent in EDIFACT INVOIC.
INVFIL: invoice file header
| Segment | Name | Status | What it carries | EANCOM equivalent |
|---|---|---|---|---|
MHD | Message header | M | Message number and INVFIL:version | UNH |
TYP | Transaction type | M | 0700 invoices, 0701 self-billed, 0709 copy invoices and others | BGM+380 and function |
SDT | Supplier details | M | Supplier GLN and code, name, address, VAT number | NAD+SU with RFF+VA |
CDT | Customer details | M | Customer GLN, name, address, VAT number | NAD+BY / NAD+IV |
DNA | Data narrative | O | File-level notes and registered codes | FTX |
FIL | File details | M | File generation number, version and date | No direct equivalent |
FDT | File period dates | O | Invoice and delivery period end dates | DTM period |
ACD | Audit control details | O | Location of the system that generated the file | None |
MTR | Message trailer | M | Segment count | UNT |
INVOIC: one per invoice
| Segment | Name | Status | What it carries | EANCOM equivalent |
|---|---|---|---|---|
CLO | Customer's location | M | Delivery or invoiced location: GLN and codes | NAD+DP |
IRF | Invoice references | M | Invoice number, invoice date, tax point date | BGM number, DTM+137, DTM+131 |
PYT | Settlement terms | O | Settlement discount terms | PAT |
DNA | Data narrative | O | Invoice-level notes | FTX |
ODD | Order and delivery references | M, repeats | Customer order number and date, delivery note number and date, proof of delivery | RFF+ON, RFF+DQ |
ILD | Invoice line details | M, repeats | Product, pack, quantity, unit cost, line cost, VAT category and rate | LIN, QTY+47, PRI+AAA, MOA+203, TAX+7 |
CIA | Complex invoice line adjustments | O | Line-level allowances and charges | ALC at line level |
DNC | Narrative details | O | Line-level notes | FTX at line level |
STL | VAT rate invoice sub-trailer | M, one per rate | Lines, net value, discounts, surcharges, VAT and payable for one VAT rate | Summary TAX+7 with MOA+125 and MOA+124 |
TLR | Invoice trailer | M | Totals across all STL segments | MOA+79, MOA+125, MOA+176, MOA+86 |
VATTLR and INVTLR: file trailers
| Message | Segment | What it carries | EANCOM equivalent |
|---|---|---|---|
VATTLR | VRS VAT rate summary, one per rate | Net, VAT and payable totals for one VAT rate across every invoice in the file | None; each EANCOM invoice stands alone |
INVTLR | TOT file totals | Net, VAT and payable totals for the file, and the number of invoices | None |
Reading the ILD invoice line
| Position | Field | In ILD=1+1+5098765100016:KV-1001+++6+40+90000+3600000+S+20000+++BAMBOO CHOPPING BOARD:LARGE' |
|---|---|---|
| 1 | SEQA links the line to its ODD order and delivery reference | 1 |
| 2 | SEQB line number within that reference | 1 |
| 3 | SPRO GTIN of the traded unit, supplier's code, DUN-14 | 5098765100016:KV-1001 |
| 4 | SACU consumer unit EAN | empty |
| 5 | CPRO customer's own-brand EAN and item code | empty |
| 6 | UNOR consumer units per traded unit | 6 |
| 7 | QTYI traded units invoiced | 40 |
| 8 | AUCT unit cost after line discount, before VAT | 90000 (£9.00) |
| 9 | LEXC extended line cost, AUCT x QTYI | 3600000 (£360.00) |
| 10 | VATC VAT category | S |
| 11 | VATP VAT rate | 20000 (20%) |
| 12 to 13 | MIXI mixed VAT indicator, CRLI credit line indicator | empty |
| 14 | TDES description | BAMBOO CHOPPING BOARD:LARGE |
Further optional positions carry recommended and marked retail prices, unit cost before discount (BUCT), discount value and percentage, and the VAT type of supply. The common VAT category codes are S standard, Z zero, L lower (reduced) rate, X exempt and A mixed-rate item.
How the VAT arithmetic chains together
The totals in an INVFIL are layered, and each layer must equal the sum of the one below:
- ILD:
LEXC=AUCTxQTYIfor each line. - STL, one per VAT rate per invoice:
LVLAis the sum ofLEXCat that rate.EVLA=LVLAless quantity and value discounts plus surcharges.ASDA=EVLAless settlement discount.VATAis the VAT.APSE=EVLA+VATAandAPSI=ASDA+VATA. - TLR, one per invoice: each total is the sum of the matching STL field, and
NSTLcounts the STLs. - VRS, one per VAT rate per file: sums of the STL values at that rate across every invoice.
- TOT, one per file: sums of the VRS values, plus
FTNI, the number of invoices.
A retailer's system re-adds every layer. If your ERP calculates VAT per line and the retailer's per rate, the totals can disagree by a penny, and a penny is enough to fail the file.
Example: two invoices, two VAT rates
Two store invoices in one file. The Leeds invoice is all standard-rated. The York invoice adds a recipe book, which is zero-rated under UK VAT, so it has two STL segments. The VATTLR then carries one VRS per rate across both invoices, and TOT adds them up.
INVFIL file with two invoices and a VAT summary
Two INVOIC messages, one with standard and zero-rated lines. VATTLR summarises each VAT rate across the file and INVTLR counts two invoices.
INVFIL · Invoice file header · ref 1
Parties
| Role | Identifier | Name and address |
|---|---|---|
| Supplier SDT | 5098765000002GS1 GLN | KESTREL VALLEY HOMEWARE LTD |
| Customer CDT | 5012345000008GS1 GLN | HARBOUR LANE STORES LTD |
INVOIC · Invoice · ref 2
- Document
- Invoice
- Document number
- KV-INV-20932
- Invoice date
- 2026-10-17
Parties
| Role | Identifier | Name and address |
|---|---|---|
| Delivery location CLO | 5012345000114GS1 GLN | HARBOUR LANE LEEDS |
Lines (2)
| # | GTIN | Codes | Description | Qty | Price | Amount |
|---|---|---|---|---|---|---|
| 1.1 | - | - | - | - | - | - |
| 1.2 | - | - | - | - | - | - |
INVOIC · Invoice · ref 3
- Document
- Invoice
- Document number
- KV-INV-20933
- Invoice date
- 2026-10-17
Parties
| Role | Identifier | Name and address |
|---|---|---|
| Delivery location CLO | 5012345000121GS1 GLN | HARBOUR LANE YORK |
Lines (2)
| # | GTIN | Codes | Description | Qty | Price | Amount |
|---|---|---|---|---|---|---|
| 1.1 | - | - | - | - | - | - |
| 1.2 | - | - | - | - | - | - |
VATTLR · VAT trailer · ref 4
INVTLR · Invoice file trailer · ref 5
Transmission (STX)
- Sender
- KESTREL VALLEY HOMEWAREcode 5098765000002
- Recipient
- HARBOUR LANE STORES LTDcode 5012345000008
- Prepared
- 2026-10-17 17:05:00
- Control reference
- KV0000319
- Syntax
- ANA:1
- Messages
- 5
Check the chain: Leeds pays £56.88 and York £48.60, so the file total payable is £105.48 (10548). The standard-rate VRS adds the two standard-rate STLs (£47.40 + £18.00 = £65.40 net, £13.08 VAT), and the zero-rate VRS carries the book alone.
Settlement discount, surcharges and reconciliation
- Settlement discount. If you offer a prompt payment discount, show it in
PYTand carry the discount in each STL'sSEDA.ASDAandAPSIthen show the after-discount values, andTLRandTOTrepeat both sets of totals. - Carriage and other surcharges. These go in the STL
SURAfield for the VAT rate they attract, and roll up intoEVLA. The JLP spec, for instance, lists registered codes inDNAfor carriage and miscellaneous charges. - The RSGRSG reconciliation message. Some partners want an extra message at the end of the transmission,
RSGRSG, which repeats the sender's transmission reference and the receiver's code so the file can be reconciled. The JLP invoice specification asks for it, and changes theSTXsyntax identifier fromANAtoANAAwhen it is sent. - Test and live references. JLP also uses the
STXapplication reference to separate test files (INVTES) from live ones (INVFIL). Ask your partner whether they do the same before you go live.
INVFIL to EANCOM INVOIC
| Business data | TRADACOMS invoice file | EANCOM INVOIC |
|---|---|---|
| Document type | TYP=0700 | BGM+380 |
| Invoice number and date | IRF | BGM and DTM+137 |
| Tax point date | IRF third element | DTM+131 |
| Order and delivery note | ODD | RFF+ON and RFF+DQ |
| Supplier VAT number | SDT | NAD+SU with RFF+VA |
| Line quantity | ILD QTYI | QTY+47 |
| Unit price | ILD AUCT, implied decimals | PRI+AAA, explicit decimal |
| Line amount | ILD LEXC | MOA+203 |
| Line VAT rate | ILD VATC, VATP | TAX+7+VAT+++:::20+S |
| VAT per rate | STL | Summary TAX with MOA+125 and MOA+124 |
| Invoice totals | TLR | MOA+79, MOA+125, MOA+176, MOA+86 |
| File VAT summary and totals | VATTLR, INVTLR | None; each invoice is self-contained |
The X12 counterpart is the 810 invoice. Credit notes do not go in an INVFIL: TRADACOMS has a separate credit note file, CREHDR.
Which UK retailers take INVFIL
- Waitrose and the wider John Lewis Partnership take TRADACOMS INVFIL invoices, and publish the field-level specification on the JLP supplier site. See the Waitrose page.
- Ocado takes INVFIL invoices but does not accept credit or debit notes by EDI, per ecosio. See the Ocado page.
- Co-op requires invoices by EDI in TRADACOMS version 9, or through its SNC portal, and warns that late invoices can be paid late. See the Co-op page.
- Asda trades invoices and credit notes in TRADACOMS, per ecosio. See the Asda page.
- Boots trades invoices in TRADACOMS, per Cegedim. See the Boots page.
Common INVFIL errors
- A VATTLR after every invoice. VATTLR and INVTLR appear once per file, after the last INVOIC.
- Rounding per line instead of per rate. Sum
LEXCvalues, then round the STL. Recalculate VAT from the STL net, not by adding line VAT. - STL count wrong.
TLRNSTLmust equal the number of STL segments in that invoice, and each STLNRILthe number of ILD lines at that rate. - MTR and END counts.
MTRcounts every segment fromMHDtoMTRinclusive.ENDcounts every message, including the INVFIL header and both trailers, so one invoice givesEND=4. - File generation number out of sequence.
FILgeneration numbers run in sequence per file type and trading partner. The JLP specification states that files out of sequence are rejected, so never reuse or skip one, and send a corrected file with the next number unless your partner says otherwise. - Invoicing ordered quantities. Invoice what was delivered and accepted. If the retailer sent a delivery confirmation (DLCHDR) showing a shortage, invoice the received quantity or expect a debit.
How OrderSync handles INVFIL
OrderSync builds INVFIL files from the orders and deliveries already in your system, with VAT calculated per rate the way TRADACOMS expects, so the STL, TLR, VRS and TOT layers agree before the file leaves. The same order can be invoiced as TRADACOMS, EANCOM, X12 or PDF depending on the customer.
Frequently Asked Questions
What is INVFIL in EDI?
INVFIL is the TRADACOMS invoice file used in UK retail. Strictly it is the name of the file header message, but the whole invoice file is usually called INVFIL. It contains the header, one INVOIC message per invoice, a VATTLR VAT summary and an INVTLR file trailer.
What is the difference between INVFIL and INVOIC?
INVFIL is the header message sent once per file with the supplier and customer details. INVOIC is the detail message sent once per invoice. The EDIFACT standard also has a message called INVOIC, but it is a different format with different segments.
What do VATTLR and INVTLR do?
VATTLR summarises VAT for the whole file, with one VRS segment per VAT rate. INVTLR closes the file with a TOT segment holding the file totals and the number of invoices. The customer's system checks both against the invoices before accepting the file.
Can a TRADACOMS invoice file contain credit notes?
Not in the standard layout. Credit notes go in a separate credit note file with a CREHDR header, CREDIT messages and their own trailers. Some partners do not accept credit notes by EDI at all, so check before you build one.
What is the EDIFACT equivalent of INVFIL?
The EANCOM INVOIC message with document code BGM+380. Each EANCOM invoice is self-contained, so the file-level VATTLR and INVTLR summaries have no direct equivalent.
Related guides
- TRADACOMS explained: syntax, STX and END, and how files work
- TRADACOMS ORDHDR: the order file you are invoicing against
- TRADACOMS CREHDR: the credit note file
- TRADACOMS file types: every file type and its EANCOM equivalent
- EDIFACT INVOIC: the EANCOM invoice
Sources
- EDI - Tradacoms invoice specifications, John Lewis Partnership
- TRADACOMS release 9 INVOIC layout, KA Software schema reference, including the ILD, STL, TLR and TOT segment pages
- TRADACOMS EDI Connector, MuleSoft: INVFIL, INVOIC, VATTLR and INVTLR file structure
- Tradacoms invoices, Software AG Tech Community
- Co-op supplier guidelines, Co-op
- Setting up an EDI connection with Ocado, ecosio
- Ending support for TRADACOMS, GS1 UK
Check an INVFIL's structure, counts and trailers in the free EDIFACT inspector.