Exactly one document type

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

The relevant ram:AdditionalReferencedDocument does not contain exactly one ram:TypeCode element. The element is either missing or occurs more than once.

What the rule means

A referenced document with the value 916 must be structurally identified by exactly one ram:TypeCode element.

Please provide exactly one document type for the referenced document

The referenced document with the value 916 is missing its document type, or the type is entered more than once. You can correct this by providing exactly one ram:TypeCode there.

What to do
  1. Find the ram:AdditionalReferencedDocument whose ram:TypeCode has the value 916.
  2. Check that this referenced document contains exactly one ram:TypeCode element.
  3. Generate the invoice again and validate it again.
What it looks like
✗ Triggers the message
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>916</ram:TypeCode>
  <ram:TypeCode>916</ram:TypeCode>
</ram:AdditionalReferencedDocument>
✓ Correct
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>916</ram:TypeCode>
</ram:AdditionalReferencedDocument>
Technical details

The rule applies to ram:AdditionalReferencedDocument with ram:TypeCode equal to 916 and checks whether the number of child ram:TypeCode elements is exactly one.

Where the rule applies

In the document-level ram:AdditionalReferencedDocument whose ram:TypeCode has the value 916.

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