# BR-CO-21 Document allowance needs a reason or reason code

Each document level allowance (BG-20) shall contain a document level allowance reason (BT-97) or a document level allowance reason code (BT-98), or both.

## Problem Description

Each document level allowance (BG-20) shall contain a document level allowance reason (BT-97) or a document level allowance reason code (BT-98), or both.

> **ERROR**: XRechnung 3.0

## Context and Significance

This EN16931 core rule ensures every deduction is justified so buyers and auditors can see why the amount was subtracted.

## Solution

For every document level allowance, add an AllowanceChargeReason (BT-97) and/or AllowanceChargeReasonCode (BT-98).

- validate
- convert

## Valid Examples

- Document allowance with BT-98 = 95 and BT-97 = "Volume discount"

## Invalid Examples

- Document allowance amount 10.00 with neither BT-97 nor BT-98

## Code Examples

### Valid XML
```
<cac:AllowanceCharge>
  <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
  <cbc:AllowanceChargeReasonCode>95</cbc:AllowanceChargeReasonCode>
  <cbc:AllowanceChargeReason>Volume discount</cbc:AllowanceChargeReason>
  <cbc:Amount currencyID="EUR">10.00</cbc:Amount>
</cac:AllowanceCharge>
```

### Invalid XML
```
<cac:AllowanceCharge>
  <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
  <cbc:Amount currencyID="EUR">10.00</cbc:Amount>
</cac:AllowanceCharge>
```

## Affected Fields

- [BG-20 Document level allowances](/resources/xrechnung)
- [BT-97 Document level allowance reason](/resources/xrechnung/bt-97-document-level-allowance-reason)
- [BT-98 Document level allowance reason code](/resources/xrechnung/bt-98-document-level-allowance-reason-code)

## Related Rules

- [BR-CO-05](/resources/kosit-validator-errors/br-co-05-allowance-reason-code-match)
- [BR-CO-22](/resources/kosit-validator-errors/br-co-22-document-charge-reason-required)
- [BR-CO-23](/resources/kosit-validator-errors/br-co-23-line-allowance-reason-required)

## Validation Tools

- [Official KoSIT Validator](https://erechnungsvalidator.service-bw.de/): Validate your XRechnung files against all BR-DE rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Automatic validation error fixes when converting.

## Related Resources

- [Official Specification](https://xeinkauf.de/xrechnung/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [Complete Error List](/resources/kosit-validator-errors): Overview of all German XRechnung validation rules.
