At most one ram:TotalAllowanceChargeAmount per invoice line

Error FX-SCH-A-000341 Factur-X

Element 'ram:TotalAllowanceChargeAmount' 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:TotalAllowanceChargeAmount occurs more than once in ram:SpecifiedTradeSettlementLineMonetarySummation. The test allows at most one such element.

What the rule means

The total amount of allowances and charges for the invoice line is stated at most once in this summation.

Please state the total allowance and charge amount only once per invoice line

ram:TotalAllowanceChargeAmount was provided more than once for an invoice line. The element may occur only once in the summation.

What to do
  1. Find ram:TotalAllowanceChargeAmount in ram:SpecifiedTradeSettlementLineMonetarySummation.
  2. Make sure the 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:TotalAllowanceChargeAmount>1.00</ram:TotalAllowanceChargeAmount>
  <ram:TotalAllowanceChargeAmount>2.00</ram:TotalAllowanceChargeAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
✓ Correct
<ram:SpecifiedTradeSettlementLineMonetarySummation>
  <ram:TotalAllowanceChargeAmount>1.00</ram:TotalAllowanceChargeAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
Technical details

The XPath counts the child ram:TotalAllowanceChargeAmount elements and requires their number to be no greater than one.

Where the rule applies

The rule applies in ram:SpecifiedTradeSettlementLineMonetarySummation within the settlement of an invoice line.

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