Unit code not allowed for billed quantity

Error FX-SCH-A-000613 Factur-X

Value of '@unitCode' is not allowed.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

The value of the @unitCode attribute in ram:BilledQuantity is neither empty nor included in the applicable code list.

What the rule means

The unit code indicates the measurement unit in which the line item's billed quantity is expressed. A code that is not allowed prevents this quantity from being classified unambiguously.

Please use an allowed unit code for the billed quantity

The line item's billed quantity contains a unit code that is not in the applicable code list. You can change the entry to an allowed unit code.

What to do
  1. Locate the line item's ram:BilledQuantity element.
  2. Check its @unitCode attribute and use only a code from the allowed code list.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:BilledQuantity unitCode="INVALID">1</ram:BilledQuantity>
✓ Correct
<ram:BilledQuantity unitCode="">1</ram:BilledQuantity>
Technical details

The XPath test accepts an empty value or a value included in code list 8.

Where the rule applies

The rule applies to the @unitCode attribute of a line item's ram:BilledQuantity.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeDelivery/ram:BilledQuantity
Test expression (assert/@test)
string-length($codeValue8)=0 or document('FACTUR-X_EN16931_codedb.xml')/codedb/cl[@id=8]/enumeration[@value=$codeValue8]