Include ram:RoleCode no more than once

Error FX-SCH-A-001090 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:RoleCode element occurs more than once within ram:ShipToTradeParty. This element may appear there no more than once.

What the rule means

ram:RoleCode contains a role designation for ram:ShipToTradeParty. The rule limits this element to one occurrence.

Please include the delivery recipient role code only once

The delivery recipient contains ram:RoleCode more than once. You can resolve the issue by limiting it to no more than one element.

What to do
  1. Locate ram:ShipToTradeParty in the invoice line’s delivery information.
  2. Remove 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:ShipToTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:ShipToTradeParty>
✓ Correct
<ram:ShipToTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:ShipToTradeParty>
Technical details

The test counts the direct ram:RoleCode elements within ram:ShipToTradeParty and passes when no more than one is present.

Where the rule applies

The rule applies within ram:ShipToTradeParty in the delivery information for an invoice line.

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