Invalid reason code for a charge without listID

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

A non-empty value in this ram:ReasonCode is not included in the designated value list. An empty value passes this check.

What the rule means

ram:ReasonCode states the reason for the charge. When listID is absent, the code is checked against the designated value list for this case.

Please use an allowed reason code for the charge without listID

The reason code for the charge on the invoice line is not in the designated value list. This check applies to ram:ReasonCode without the listID attribute.

What to do
  1. Check ram:ReasonCode for the charge whose ram:ChargeIndicator has the value true and which has no listID.
  2. For a non-empty value, use an entry from the designated value list.
  3. Generate the invoice again and validate it.
Technical details

The test permits an empty code value; otherwise, it checks the value against the enumeration in code list 29.

Where the rule applies

The rule applies to ram:ReasonCode of a charge on an invoice line where ram:ChargeIndicator has the value true and the element has no listID attribute.

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