Invoice line allowance total only once

Error FX-SCH-A-001141 Factur-X

Element 'ram:AllowanceTotalAmount' 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:AllowanceTotalAmount occurs more than once in ram:SpecifiedTradeSettlementLineMonetarySummation.

What the rule means

ram:AllowanceTotalAmount gives the total allowances for the invoice line. Multiple occurrences would provide more than one value for that total.

Please include the invoice line allowance total only once

The total allowances appear more than once in an invoice line’s settlement. This element may occur there no more than once.

What to do
  1. Look for repeated ram:AllowanceTotalAmount elements in ram:SpecifiedTradeSettlementLineMonetarySummation.
  2. Make sure this element occurs there no more than once.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:SpecifiedTradeSettlementLineMonetarySummation>
  <ram:AllowanceTotalAmount>10.00</ram:AllowanceTotalAmount>
  <ram:AllowanceTotalAmount>20.00</ram:AllowanceTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
✓ Correct
<ram:SpecifiedTradeSettlementLineMonetarySummation>
  <ram:AllowanceTotalAmount>10.00</ram:AllowanceTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
Technical details

The XPath counts ram:AllowanceTotalAmount elements in the current ram:SpecifiedTradeSettlementLineMonetarySummation; the test passes when there is at most one.

Where the rule applies

The rule applies to the monetary summation in an invoice line’s settlement and checks ram:AllowanceTotalAmount there.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation
Test expression (assert/@test)
count(ram:AllowanceTotalAmount)<=1