At most one buyer agent role code

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. This element may occur at most once there.

What the rule means

The rule limits the buyer agent role information to no more than one ram:RoleCode element.

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

Several ram:RoleCode elements are present in ram:BuyerAgentTradeParty. The rule allows at most one there; a role code is not required.

What to do
  1. Locate ram:BuyerAgentTradeParty in the invoice agreement section.
  2. Remove any extra ram:RoleCode elements so that no more than one remains.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:BuyerAgentTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:BuyerAgentTradeParty>
✓ Correct
<ram:BuyerAgentTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:BuyerAgentTradeParty>
Technical details

The test counts the direct ram:RoleCode elements under ram:BuyerAgentTradeParty and requires no more than 1; the element may be absent.

Where the rule applies

The rule applies to ram:RoleCode within ram:BuyerAgentTradeParty in the document-level agreement section.

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