Invalid reason code on a charge

Error FX-SCH-A-000523 Factur-X

Value of 'ram:ReasonCode[not (@listID)]' 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 in ram:ReasonCode without listID is not included in the code list specified for this field. An empty value does not trigger this error according to the test condition.

What the rule means

The reason code describes the reason for the charge. A code not in the list can prevent that reason from being classified as intended.

Please use an allowed reason code for the charge

The reason code ram:ReasonCode on the charge is not included in the specified code list. You can correct the entry by using a value allowed in that list.

What to do
  1. Locate the document-level charge and check ram:ReasonCode without the listID attribute.
  2. Replace the disallowed value with one included in the specified code list.
  3. Regenerate the invoice and validate it again.
Technical details

The test checks the value of ram:ReasonCode without listID against code list 22 of the Factur-X code database; an empty value is accepted.

Where the rule applies

The rule applies to ram:ReasonCode without the listID attribute on a document-level charge.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator="true"]/ ram:ReasonCode[not (@listID)]
Test expression (assert/@test)
string-length($codeValue22)=0 or document('FACTUR-X_BASIC_codedb.xml')/codedb/cl[@id=22]/enumeration[@value=$codeValue22]