# 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

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

## Context and Significance

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".

## 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.

- [Validate XML](/en/xrechnung-validator?source=resource&rule=BR-CL-23)
- [Convert invoice](/en/pdf-to-xrechnung?source=resource&rule=BR-CL-23)

## 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.
