At most one country subdivision in the buyer address

Error FX-SCH-A-000167 Factur-X

Element 'ram:CountrySubDivisionName' may occur at maximum 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

CountrySubDivisionName occurs more than once in PostalTradeAddress. This element may appear there no more than once.

What the rule means

The rule limits the number of country subdivision entries in the buyer’s postal address to one.

Please use no more than one country subdivision in the buyer address

CountrySubDivisionName appears more than once in the buyer’s postal address. You can adjust the section so that this element appears no more than once.

What to do
  1. Locate PostalTradeAddress in the BuyerTradeParty section.
  2. Check how many times CountrySubDivisionName occurs inside it.
  3. Remove any occurrences beyond the first.
  4. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress>
  <ram:CountrySubDivisionName>North</ram:CountrySubDivisionName>
  <ram:CountrySubDivisionName>West</ram:CountrySubDivisionName>
</ram:PostalTradeAddress>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountrySubDivisionName>North</ram:CountrySubDivisionName>
</ram:PostalTradeAddress>
Technical details

Within PostalTradeAddress, the number of direct CountrySubDivisionName elements is counted and checked against a maximum of one.

Where the rule applies

The rule applies to the buyer’s postal address PostalTradeAddress.

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