Exactly one country identifier for the ultimate ship-to address

Error FX-SCH-A-000841 Factur-X

Element 'ram:CountryID' 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:CountryID is missing from PostalTradeAddress or occurs more than once. This address must contain the element exactly once.

What the rule means

The country identifier specifies the country of the ultimate ship-to address. Exactly one value is required to identify the country for this address.

Please provide exactly one country identifier for the ultimate ship-to address

The country identifier is missing from the ultimate ship-to postal address or is entered more than once. You can fix this by having a single ram:CountryID entry.

What to do
  1. Locate PostalTradeAddress under UltimateShipToTradeParty.
  2. Make sure ram:CountryID occurs there exactly once.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
Technical details

The test counts the direct ram:CountryID elements in PostalTradeAddress and requires the count to be 1.

Where the rule applies

The rule applies to the postal address of the ultimate ship-to party under UltimateShipToTradeParty.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ ram:UltimateShipToTradeParty/ram:PostalTradeAddress
Test expression (assert/@test)
count(ram:CountryID)=1