Invalid document type code

Error FX-SCH-A-000640 Factur-X

Value of 'ram:TypeCode' 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 of ram:TypeCode is not included in the code list specified for this element. This check does not report an empty value as an error.

What the rule means

ram:TypeCode identifies the kind of referenced document. A code not in the list does not correspond to a document type allowed in this context.

Please use an allowed document type code for the referenced document

The value in ram:TypeCode is not included in the code list applicable to this referenced document. Using a value listed there can resolve the issue.

What to do
  1. Locate the additional referenced document whose ram:TypeCode is being checked.
  2. Check the value of ram:TypeCode against the applicable code list.
  3. Enter a value listed there.
  4. Regenerate the invoice and validate it again.
Technical details

The assertion compares the value with entries in the code list identified by 40. An empty value also satisfies the condition.

Where the rule applies

The rule applies to ram:TypeCode of an additional referenced document of type 130 within the document-level agreement.

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