The buyer agent’s postal address requires a country code

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

CountryID is missing from the buyer agent’s PostalTradeAddress or occurs more than once. CountryID must appear exactly once.

What the rule means

The buyer agent’s postal address requires exactly one CountryID element to specify the country in the XML structure.

Please provide a country code in the buyer agent’s postal address

CountryID is missing or appears more than once in the buyer agent’s postal address. Exactly one CountryID element resolves this issue.

What to do
  1. Find PostalTradeAddress in BuyerAgentTradeParty.
  2. Make sure it contains exactly one CountryID element.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:BuyerAgentTradeParty>
  <ram:PostalTradeAddress/>
</ram:BuyerAgentTradeParty>
✓ Correct
<ram:BuyerAgentTradeParty>
  <ram:PostalTradeAddress>
    <ram:CountryID>DE</ram:CountryID>
  </ram:PostalTradeAddress>
</ram:BuyerAgentTradeParty>
Technical details

The test counts the direct CountryID child elements of PostalTradeAddress and requires exactly one.

Where the rule applies

The rule applies to PostalTradeAddress within BuyerAgentTradeParty and the CountryID element it contains.

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