Exactly one type code for the additional referenced document

Error FX-SCH-A-000558 Factur-X

Element 'ram:TypeCode' must occur exactly 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

In the relevant ram:AdditionalReferencedDocument, ram:TypeCode does not occur exactly once. It is missing or occurs more than once.

What the rule means

ram:TypeCode identifies the type of the additional referenced document. For a document with type code 130, this element must be present exactly once.

Please include type code `130` exactly once

The additional referenced document with type code 130 is missing ram:TypeCode, or the element occurs more than once. You can resolve this by including the element exactly once.

What to do
  1. Open the relevant ram:AdditionalReferencedDocument.
  2. Make sure it contains ram:TypeCode exactly once.
  3. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<ram:AdditionalReferencedDocument>
  <ram:IssuerAssignedID>REF-1</ram:IssuerAssignedID>
</ram:AdditionalReferencedDocument>
✓ Correct
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>130</ram:TypeCode>
</ram:AdditionalReferencedDocument>
Technical details

The XPath context selects ram:AdditionalReferencedDocument based on the value 130 in ram:TypeCode. The test requires exactly one child ram:TypeCode element.

Where the rule applies

The rule applies to an additional referenced document at document level whose ram:TypeCode has the value 130.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:AdditionalReferencedDocument[ram:TypeCode="130"]
Test expression (assert/@test)
count(ram:TypeCode)=1