Exactly one country identifier for the legal organization

Error FX-SCH-A-000845 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 legal organization’s postal address. Exactly one value is required to identify the country for this address.

Please provide exactly one country identifier for the legal organization

The country identifier is missing from the legal organization’s 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 SpecifiedLegalOrganization for the ultimate ship-to party.
  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 PostalTradeAddress of the SpecifiedLegalOrganization for the ultimate ship-to party.

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