Invalid reason code for an allowance

Error FX-SCH-A-001137 Factur-X

Value of 'ram:ReasonCode' 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 ram:ReasonCode is not included in the value list designated for the allowance reason. An empty value passes this check.

What the rule means

ram:ReasonCode states the reason for the allowance. A non-empty reason code must match an allowed entry.

Please use an allowed reason code for the allowance

The reason code for the allowance on the invoice line is not in the designated value list. Using an allowed code will satisfy this check.

What to do
  1. Check ram:ReasonCode for the allowance whose ram:ChargeIndicator has the value false.
  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 28.

Where the rule applies

The rule applies to ram:ReasonCode of an allowance on an invoice line where ram:ChargeIndicator has the value false.

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