At most one ram:RoleCode for the invoicee

Error FX-SCH-A-000866 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:RoleCode occurs more than once in ram:InvoiceeTradeParty. This element may appear there at most once.

What the rule means

The limit prevents multiple role code entries for the same invoicee within this element.

Please use no more than one `ram:RoleCode` for the invoicee

The invoicee has multiple ram:RoleCode elements. Keep no more than one.

What to do
  1. Find ram:InvoiceeTradeParty in the invoice.
  2. Remove additional 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:InvoiceeTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:InvoiceeTradeParty>
✓ Correct
<ram:InvoiceeTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:InvoiceeTradeParty>
Technical details

The test counts the direct ram:RoleCode elements in ram:InvoiceeTradeParty and requires a count of no more than one.

Where the rule applies

The rule applies to ram:RoleCode within ram:InvoiceeTradeParty, the invoicee.

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