At most one role code for the ultimate ship-to party

Error FX-SCH-A-001109 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:UltimateShipToTradeParty.

What the rule means

The ultimate ship-to party may have no more than one role code in this context.

Please use at most one role code for the ultimate ship-to party

ram:RoleCode is entered more than once for the ultimate ship-to party. You can resolve this by removing the duplicate entry.

What to do
  1. Remove any additional ram:RoleCode entries from ram:UltimateShipToTradeParty.
  2. Regenerate the invoice and check it again.
What it looks like
✗ Triggers the message
<ram:UltimateShipToTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:UltimateShipToTradeParty>
✓ Correct
<ram:UltimateShipToTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:UltimateShipToTradeParty>
Technical details

The check counts the direct ram:RoleCode elements in the current ram:UltimateShipToTradeParty and permits at most one.

Where the rule applies

The rule applies to ram:RoleCode within ram:UltimateShipToTradeParty of an invoice line.

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