← All Error Rules
error Class A

BR-DE-13 Unit Code

What this rule checks

BR-DE-13 validates that the unit of measure for an invoice line in field BT-130 (Invoiced quantity unit of measure) uses a valid code from UN/ECE Recommendation No. 20. The code is specified in the XML as the unitCode attribute of the cbc:InvoicedQuantity element.

The rule ensures that free-text units (e.g., “pieces”, “hours”, “Stück”) are not used — only standardized alphanumeric codes from the UN/ECE codelist are accepted.

Why this rule exists

Standardized unit codes are essential for automated invoice processing:

  • Interoperability: Receiving systems must be able to interpret quantities programmatically. The code C62 is universally understood as “one/piece”, whereas “pcs”, “Stück”, or “pieces” can be ambiguous.
  • Automated goods receipt matching: ERP systems compare the unit of measure on invoices against purchase orders. Only matching UN/ECE codes enable automated three-way matching.
  • European Standard EN 16931: Directive 2014/55/EU on electronic invoicing mandates the use of UN/ECE Recommendation 20.

What triggers a failure

The rule fails when:

  • The unitCode attribute contains free text (e.g., Stück, Stunden, pieces)
  • An invalid or non-existent code is used
  • The unitCode attribute is missing entirely
  • A deprecated or withdrawn code is used

Failing XML example

<cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <!-- ERROR: German free text instead of UN/ECE code -->
  <cbc:InvoicedQuantity unitCode="Stück">10</cbc:InvoicedQuantity>
  <cbc:LineExtensionAmount currencyID="EUR">500.00</cbc:LineExtensionAmount>
  <cac:Item>
    <cbc:Name>Office Chair Model X</cbc:Name>
  </cac:Item>
</cac:InvoiceLine>

The value Stück is not a valid UN/ECE Rec 20 code. While a human reader understands the meaning, validation systems cannot process this value.

The fix

<cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <!-- CORRECT: C62 = one/piece per UN/ECE Rec 20 -->
  <cbc:InvoicedQuantity unitCode="C62">10</cbc:InvoicedQuantity>
  <cbc:LineExtensionAmount currencyID="EUR">500.00</cbc:LineExtensionAmount>
  <cac:Item>
    <cbc:Name>Office Chair Model X</cbc:Name>
  </cac:Item>
</cac:InvoiceLine>

Use the correct UN/ECE code as the value of the unitCode attribute. Note that the code is an XML attribute, not element content.

Edge cases and common mistakes

Commonly used UN/ECE Rec 20 codes

CodeMeaningTypical use
C62One (piece)Goods, articles, units
H87PieceAlternative to C62
HURHourServices, consulting
DAYDayDaily rates
MONMonthMonthly subscriptions
KGMKilogramWeight-based goods
MTRMetreLength-based goods
LTRLitreLiquids
MTKSquare metreArea-based services
KWHKilowatt hourEnergy
SETSetBundles, kits
LSLump sumFlat-rate services

Further important notes

  • C62 vs. H87: Both mean “piece” but are technically different codes. C62 (one) is more commonly used in German practice. Clarify with your trading partner which code is expected.
  • Case sensitivity: Codes are case-sensitive. c62 is invalid; use C62.
  • Attribute, not element: unitCode is an XML attribute of cbc:InvoicedQuantity, not a separate element. Write <cbc:InvoicedQuantity unitCode="C62">, not <cbc:UnitCode>C62</cbc:UnitCode>.
  • Deprecated codes: Some codes have been withdrawn in newer versions of the recommendation. Make sure you are using the current version (Revision 11 or later).
  • Order matching: Use the same unitCode in invoices and corresponding purchase orders to enable automated matching processes.