Unallowed country code for the legal organization

Error FX-SCH-A-000664 Factur-X

Value of 'ram:CountryID' is not allowed.

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

If ram:CountryID contains a value, that value must be included in the country code list. A value not listed there is not allowed.

What the rule means

An allowed country code identifies the country of the legal organization’s postal address unambiguously.

Please use an allowed country code for the legal organization

The country code in the legal organization’s postal address is not included in the specified code list. Using a value from that list will resolve the issue.

What to do
  1. Locate ram:PostalTradeAddress under ram:SpecifiedLegalOrganization.
  2. Check the value of ram:CountryID against the specified code list.
  3. Regenerate the invoice and validate it again.
Technical details

The test allows an empty value. A non-empty value must occur as an enumeration in the code list with cl ID 10.

Where the rule applies

The country code in ram:CountryID in the postal address of ram:SpecifiedLegalOrganization of the buyer agent is checked.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:BuyerAgentTradeParty/ram:SpecifiedLegalOrganization/ram:PostalTradeAddress/ ram:CountryID
Test expression (assert/@test)
string-length($codeValue10)=0 or document('FACTUR-X_EXTENDED_codedb.xml')/codedb/cl[@id=10]/enumeration[@value=$codeValue10]