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

What the rule means

ram:TypeCode identifies the type of additional referenced document. A code that is not permitted prevents the document type from being classified according to the code list.

Please use an allowed type code for the referenced document

The additional referenced document has a value in ram:TypeCode that is not permitted. You can compare the type code with the allowed values.

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

The rule checks ram:TypeCode against the entries in code list ID 40 in FACTUR-X_EXTENDED_codedb.xml; an empty value is accepted by this test.

Where the rule applies

Applies to ram:TypeCode of the additional referenced document in the invoice header when its value is 130.

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]