At most one ram: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

ram:RoleCode occurs more than once in ram:BuyerTradeParty. The element may occur at most once; it may also be absent.

What the rule means

In this context, the buyer information allows at most one role code, preventing multiple role codes from being listed for the same buyer.

Please provide the buyer’s role code no more than once

The buyer information contains ram:RoleCode more than once. The element may occur at most once and may also be omitted.

What to do
  1. Check ram:BuyerTradeParty for repeated ram:RoleCode elements.
  2. Remove any additional ram:RoleCode elements or omit the element.
  3. Generate the invoice again and validate it again.
What it looks like
✗ Triggers the message
<ram:BuyerTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:BuyerTradeParty>
✓ Correct
<ram:BuyerTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:BuyerTradeParty>
Technical details

The XPath test count(ram:RoleCode)<=1 limits the number of direct ram:RoleCode child elements to at most one.

Where the rule applies

The rule applies to ram:RoleCode within the buyer information ram:BuyerTradeParty.

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