Invalid reference type code

Error FX-SCH-A-000639 Factur-X

Value of 'ram:ReferenceTypeCode' 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:ReferenceTypeCode is not permitted in the designated code list. This check does not reject an empty value.

What the rule means

ram:ReferenceTypeCode identifies the kind of reference made by the additional referenced document. A code that is not permitted may prevent the reference from being classified unambiguously.

Please use an allowed reference type for the referenced document

The additional referenced document with ram:TypeCode 130 contains a value for ram:ReferenceTypeCode that is not permitted. You can compare the code with the allowed values.

What to do
  1. Find the affected ram:AdditionalReferencedDocument with ram:TypeCode 130.
  2. Check the value of ram:ReferenceTypeCode against the allowed values in the code list.
  3. Generate the invoice again and validate it once more.
Technical details

The rule compares ram:ReferenceTypeCode with the entries in code list ID 20 in FACTUR-X_EXTENDED_codedb.xml; an empty value is accepted by this test.

Where the rule applies

Applies to ram:ReferenceTypeCode of an additional referenced document with ram:TypeCode 130 in the invoice header.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:AdditionalReferencedDocument[ram:TypeCode="130"]/ram:ReferenceTypeCode
Test expression (assert/@test)
string-length($codeValue20)=0 or document('FACTUR-X_EXTENDED_codedb.xml')/codedb/cl[@id=20]/enumeration[@value=$codeValue20]