Invalid ReasonCode for the charge

Error FX-SCH-A-001036 Factur-X

Value of 'ram:ReasonCode[@listID="5153"]' 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:ReasonCode with listID 5153 contains a value, that value must be included in the code list referenced by this rule. A value not in the list is invalid; this test does not reject an empty value.

What the rule means

The reason code assigns a reason to the charge. The code list associated with listID 5153 restricts the permitted values so that the reason is represented by an accepted code.

Please use an allowed `ReasonCode` for the charge

The ram:ReasonCode with listID 5153 provided for the charge is not included in the applicable code list. Use a code from that list or leave the value empty.

What to do
  1. Find ram:ReasonCode with listID 5153 in the charge on the invoice line’s gross price.
  2. Compare its value 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 22. The context limits the checked element to ram:ReasonCode[@listID="5153"].

Where the rule applies

The rule applies to ram:ReasonCode with listID 5153 for a charge on an invoice line’s gross price.

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