BR-CL-23: Unit code not from UN/ECE Recommendation 20 or 21
Units of measure must be codes from UN/ECE Recommendation 20 (with the Recommendation 21 package codes), written exactly as listed.
- Severity
- Error the invoice fails validation.
- Rule set
- EN 16931 (CEN/TC 434)
- Where it applies
- EN 16931 invoices in UBL and CII, in every EU country
- XRechnung 3.0 in UBL and CII (Germany)
- Peppol BIS Billing 3.0
- ZUGFeRD / Factur-X, profile EN 16931 and above
Official rule text
Unit code MUST be coded according to the UN/ECE Recommendation 20 with Rec 21 extension
What the rule checks
The rule checks the unitCode attribute of cbc:InvoicedQuantity and cbc:BaseQuantity against the code list. Codes are case-sensitive and must not contain spaces.
Common correct codes: H87 (piece), C62 (one), HUR (hour), DAY (day), MON (month), KGM (kilogram), MTR (metre), LTR (litre), LS (lump sum). Codes starting with X are package types from Recommendation 21, for example XPP (piece, single item).
Under EN 16931 and Peppol the rule is an error. In the XRechnung 3.0.2 validator configuration, KoSIT lowers it to a warning, so an XRechnung with such a unit code is still accepted; other recipients may reject it.
Common causes
- The unit is taken from the article master as the abbreviation shown on the PDF: 'pcs', 'Stk', 'h', 'Std'.
- The code is right but in lower case, such as 'kgm'.
- PCE is used for a piece; it is not in the list, H87 is.
How to fix it
Map each unit in the article master to a Recommendation 20 code once, and write that code into unitCode. Keep the readable abbreviation for the PDF.
In CII the attribute is unitCode on ram:BilledQuantity and ram:BasisQuantity.
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="pcs">12</cbc:InvoicedQuantity>
<!-- … -->
</cac:InvoiceLine><cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="H87">12</cbc:InvoicedQuantity>
<!-- … -->
</cac:InvoiceLine>UBL excerpts; elements that play no part in the rule are left out.
Can the fix page repair it?
Yes, once you supply the value. The fix page names the field; you enter the correct value, which is never guessed, and the corrected file is validated again before you download it.
Field on the fix page: lines[0].unitCode
Repair a rejected invoiceGuide: What does BR-DE-15 mean? XRechnung error codes explained
Check your invoice against the official rules
Upload an XML or PDF invoice. You get every failing rule with an explanation, the fix and the line in the file. Free, without sign-up; the check on this page stores nothing.
Processed in memory and not stored. No sign-up needed.
E-Invoicing API