Exactly one delivery type code

Error FX-SCH-A-000319 Factur-X

Element 'ram:DeliveryTypeCode' 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

Within ram:ApplicableTradeDeliveryTerms, ram:DeliveryTypeCode does not occur exactly once: the element is missing or appears more than once.

What the rule means

The delivery terms section must contain exactly one delivery type code so that the delivery term is specified unambiguously.

Please provide exactly one delivery type code

ram:DeliveryTypeCode is missing from ram:ApplicableTradeDeliveryTerms or appears more than once. You can correct the number of occurrences in the XML.

What to do
  1. Locate ram:ApplicableTradeDeliveryTerms in the invoice agreement section.
  2. Make sure it contains exactly one ram:DeliveryTypeCode.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:ApplicableTradeDeliveryTerms/>
✓ Correct
<ram:ApplicableTradeDeliveryTerms>
  <ram:DeliveryTypeCode>...</ram:DeliveryTypeCode>
</ram:ApplicableTradeDeliveryTerms>
Technical details

The test counts the direct ram:DeliveryTypeCode elements under ram:ApplicableTradeDeliveryTerms and requires a count of 1.

Where the rule applies

The rule applies within ram:ApplicableTradeDeliveryTerms in the document-level agreement section.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:ApplicableTradeDeliveryTerms
Test expression (assert/@test)
count(ram:DeliveryTypeCode)=1