ram:RoleCode may occur at most once

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

The ram:ShipToTradeParty element contains more than one ram:RoleCode element. At most one ram:RoleCode is permitted in this context.

What the rule means

The rule limits the number of role codes for ram:ShipToTradeParty to at most one.

Please use no more than one role code for the delivery recipient

Several ram:RoleCode elements are present in ram:ShipToTradeParty. Only one is allowed in this section.

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

The check counts the direct child elements ram:RoleCode of ram:ShipToTradeParty and requires their number to be no greater than one.

Where the rule applies

The rule applies within the ram:ShipToTradeParty element in the delivery section.

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