Multiple buyer agent role codes

Error FX-SCH-A-000321 Factur-X

Element 'ram:RoleCode' 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

ram:BuyerAgentTradeParty contains more than one ram:RoleCode. The element may occur no more than once.

What the rule means

ram:RoleCode specifies the role of the buyer agent. The rule limits the number of these values to one at most.

Please provide no more than one role code for the buyer agent

More than one role code is included for the buyer agent. You can limit the number of ram:RoleCode elements to no more than one.

What to do
  1. Find ram:BuyerAgentTradeParty.
  2. Check the ram:RoleCode elements it contains.
  3. Remove any additional ram:RoleCode elements so that no more than one remains.
  4. Generate the invoice again and validate it again.
Technical details

The XPath test requires ram:RoleCode to occur no more than once within ram:BuyerAgentTradeParty; zero occurrences are permitted.

Where the rule applies

The rule applies within ram:BuyerAgentTradeParty in the seller-buyer agreement.

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