Use an allowed reason code for the charge

Error FX-SCH-A-000391 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 of ram:ReasonCode when the element has no @listID attribute does not appear in the code list used by this rule. The XPath expression also permits an empty value.

What the rule means

The reason code identifies the reason for the charge. For the element checked here without @listID, a non-empty value must come from the specified code list.

Please use an allowed reason code for the charge

The non-empty value in the charge’s ram:ReasonCode is not in the corresponding code list. This rule applies to ram:ReasonCode without @listID and also permits an empty value.

What to do
  1. Find ram:ReasonCode for the charge and check whether the element has no @listID attribute.
  2. Check whether the non-empty value is included in the code list specified for this rule.
  3. Generate the invoice again and validate it once more.
Technical details

The rule context selects ram:ReasonCode without @listID. The test permits an empty $codeValue18; otherwise, the value must occur as @value in codedb/cl[@id=18]/enumeration.

Where the rule applies

The rule checks ram:ReasonCode without @listID for a document-level charge in the settlement.

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($codeValue18)=0 or document('FACTUR-X_BASIC-WL_codedb.xml')/codedb/cl[@id=18]/enumeration[@value=$codeValue18]