Exactly one ram:TypeCode

Error FX-SCH-A-001016 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

ram:TypeCode is missing from ram:AdditionalReferencedDocument or occurs more than once.

What the rule means

Each ram:AdditionalReferencedDocument at this location must contain exactly one document type code.

Please provide exactly one document type code for the referenced document

The document type code for a referenced document on an invoice line is missing or appears more than once. You can adjust the XML so that exactly one ram:TypeCode is present.

What to do
  1. Check ram:AdditionalReferencedDocument in the invoice line agreement.
  2. Ensure that it contains exactly one ram:TypeCode.
  3. Regenerate the invoice and check it again.
What it looks like
✗ Triggers the message
<ram:AdditionalReferencedDocument>
  <ram:IssuerAssignedID>REF-1</ram:IssuerAssignedID>
</ram:AdditionalReferencedDocument>
✓ Correct
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>Code</ram:TypeCode>
</ram:AdditionalReferencedDocument>
Technical details

The Schematron check counts the direct ram:TypeCode elements within ram:AdditionalReferencedDocument and requires exactly one.

Where the rule applies

The rule applies to ram:AdditionalReferencedDocument in the agreement for an invoice line.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeAgreement/ram:AdditionalReferencedDocument
Test expression (assert/@test)
count(ram:TypeCode)=1