# BR-CL-23 Unit code must come from UN/ECE Rec 20 with Rec 21

Unit of measure codes, such as the invoiced quantity unit (BT-130) and the item price base quantity unit (BT-150), must come from UN/ECE Recommendation 20, including the Rec 21 codes with the prefix X.

## Problem Description

> **WARNING**: EN 16931 code-list rule (BR-CL)

> **Where BR-CL-23 is checked**
>
> A validator checks an e-invoice in stages. First the file must be well-formed XML that matches the UBL or CII schema (XSD). Then the EN 16931 business rules run: BR core rules, BR-CO calculations, BR-CL code lists, BR-DEC decimals and VAT-category rules such as BR-S. Next come the national or network rules that BT-24 selects: BR-DE for XRechnung, PEPPOL-EN16931 for Peppol BIS Billing. The report lists every failed rule: one error means reject, warnings alone still mean accept. BR-CL-23: EN 16931 code list rule, reported in the stage “EN 16931 rules”.

## Solution

Use a valid code in exactly the listed spelling, e.g. C62 (one; the most common code for counted items and the code Invoice Converter writes), H87 (piece; use it when the recipient asks for it), KGM (kilogram), MTR (metre), LTR (litre), HUR (hour) or DAY (day). Packaging units from Rec 21 take the prefix X, e.g. XBX (box). PCE and PCS are not valid codes.

- [Check XML for free](/en/xrechnung-validator?source=resource&rule=BR-CL-23)

## Context and Significance

The EN 16931 validation artefacts flag this rule as fatal; the KoSIT configuration for XRechnung 3.0.2 lowers it to a warning. The rule checks the unitCode attribute of cbc:InvoicedQuantity, cbc:BaseQuantity and cbc:CreditedQuantity in UBL, and of ram:BilledQuantity and ram:BasisQuantity in CII. It fails when an ERP exports its own unit abbreviations such as "PCS", "pcs" or "h"; the check is case-sensitive. Map every ERP unit to one Rec 20 code in the master data. Example: 10 pieces are usually sent as unitCode="C62" (or "H87" if the recipient asks), 2.5 hours as unitCode="HUR".

## Valid Examples

- BT-130 = C62 — one (unit)
- BT-130 = H87 — piece
- BT-130 = KGM — kilogram

## Invalid Examples

- BT-130 = PCS — not a Rec 20 code; use C62 or H87
- BT-130 = h — local abbreviation; use HUR

## Code Examples

### Valid XML
```
<cbc:InvoicedQuantity unitCode="C62">10</cbc:InvoicedQuantity>
```

### Invalid XML
```
<cbc:InvoicedQuantity unitCode="PCS">10</cbc:InvoicedQuantity>
```

## Affected Fields

- [BT-130 Invoiced quantity unit of measure code](/resources/xrechnung/bt-130-invoice-line-quantity-unit-of-measure-code)
- [BT-150 Item price base quantity unit of measure code](/resources/xrechnung/bt-150-item-price-base-quantity-unit-code)

## Validation Tools

- [Official KoSIT Validator](https://github.com/itplr-kosit/validator): Run the official KoSIT validator with the XRechnung configuration to check EN 16931 and XRechnung rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Find validation errors during conversion and review each correction.

## Related Resources

- [Official Specification](https://docs.peppol.eu/poacc/billing/3.0/rules/ubl-tc434/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [All validation errors](/resources/kosit-validator-errors): Overview of the EN 16931, XRechnung and Peppol validation rules explained here.
