Invalid unitCode for the basis quantity

Error FX-SCH-A-001037 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

If ram:BasisQuantity has a value for unitCode, that value must be included in the applicable code list. A value not in the list is invalid; this test does not reject an empty value.

What the rule means

The unitCode attribute states the unit of measure for the basis quantity. The code list restricts permitted units to defined codes.

Please use an allowed `unitCode` for the basis quantity

The unitCode of ram:BasisQuantity is not included in the applicable code list. Use a value from that list or leave the attribute empty.

What to do
  1. Find ram:BasisQuantity on the invoice line’s gross price.
  2. Compare the value of unitCode with the code list referenced by this rule and use a listed value or an empty value.
  3. Regenerate the invoice and validate it again.
Technical details

The test accepts an empty value or a value listed in codedb.xml under the code list with ID 15.

Where the rule applies

The rule applies to the unitCode attribute of ram:BasisQuantity on an invoice line’s gross price.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity
Test expression (assert/@test)
string-length($codeValue15)=0 or document('FACTUR-X_EXTENDED_codedb.xml')/codedb/cl[@id=15]/enumeration[@value=$codeValue15]