At most one RoleCode for the buyer

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

RoleCode occurs more than once in BuyerTradeParty. The element may appear at most once in this context.

What the rule means

RoleCode describes the role of the buyer party. The rule limits this to at most one role code.

Please use no more than one `RoleCode` element for the buyer

The buyer details contain RoleCode more than once. You can adjust the XML structure so that there is no more than one such element.

What to do
  1. Locate the repeated RoleCode elements in BuyerTradeParty.
  2. Make sure that no more than one RoleCode remains there.
  3. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<ram:BuyerTradeParty>
  <ram:RoleCode/>
  <ram:RoleCode/>
</ram:BuyerTradeParty>
✓ Correct
<ram:BuyerTradeParty>
  <ram:RoleCode/>
</ram:BuyerTradeParty>
Technical details

The test counts the direct RoleCode elements under BuyerTradeParty and requires a count of at most 1.

Where the rule applies

The rule applies within BuyerTradeParty.

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