Invoice line needs a unit of measure code

Error BR-FXEXT-BR-23 Factur-X

An Invoice line (BG-25) shall have an Invoiced quantity unit of measure code (BT-130) if the "Subtype of invoice line item" (BT-X-8) has the value "Normal line item (standard case)" (DETAIL) or is not specified.

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

A normal invoice line is missing the unitCode attribute on ram:BilledQuantity in ram:SpecifiedLineTradeDelivery. The unit of the invoiced quantity is therefore not stated.

What the rule means

The unit of measure code states the unit in which the invoiced quantity is expressed. It is required so that the quantity can be interpreted unambiguously.

Affected fields BG-25 BT-130 BT-X-8
Please specify the unit for the invoiced quantity

No unit is specified for the invoiced quantity on this normal invoice line. Add the unit code to the quantity.

What to do
  1. Find ram:BilledQuantity in ram:SpecifiedLineTradeDelivery.
  2. Add the unitCode attribute there by setting TradeLineItem.UnitCode.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:SpecifiedLineTradeDelivery>
  <ram:BilledQuantity>2</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
✓ Correct
<ram:SpecifiedLineTradeDelivery>
  <ram:BilledQuantity unitCode="C62">2</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
Check in FactoorSharp
  • AssociatedDocument.LineStatusReasonCode (BT-X-8)
  • LineStatusReasonCodes (BT-X-8)
  • TradeLineItem.UnitCode (BT-130)
Technical details

The test requires the unitCode attribute on ram:SpecifiedLineTradeDelivery/ram:BilledQuantity. It applies only to ram:AssociatedDocumentLineDocument without ram:LineStatusReasonCode or with the value DETAIL.

Where the rule applies

The rule applies to ram:AssociatedDocumentLineDocument when ram:LineStatusReasonCode is absent or has the value DETAIL.

Context (rule/@context)
//ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument[ not(ram:LineStatusReasonCode) or ram:LineStatusReasonCode = 'DETAIL' ]
Test expression (assert/@test)
(../ram:SpecifiedLineTradeDelivery/ram:BilledQuantity/@unitCode)