What does BR-21 mean?
Every line needs a unique identifier, usually a running number. That way each line can be referenced.
Common causes of BR-21
- The element 'ram:LineID' in 'ram:AssociatedDocumentLineDocument' is missing on a line.
- The issuing system does not set the line numbering.
- Several lines share no unique identifier, or the whole 'AssociatedDocumentLineDocument' block is missing.
How to fix BR-21
- Find the faulty spot in the XML. Open the XML of the invoice and go to field BT-126 along this XPath:
//ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineID - Apply the fix. Give every Invoice line (BG-25) a unique Invoice line identifier (BT-126) in the element 'ram:AssociatedDocumentLineDocument/ram:LineID'. Number the lines consecutively, for example '1', '2', '3'.
- Validate again. Save the file and validate it again to check that BR-21 is no longer reported.
Give every Invoice line (BG-25) a unique Invoice line identifier (BT-126) in the element 'ram:AssociatedDocumentLineDocument/ram:LineID'. Number the lines consecutively, for example '1', '2', '3'.
//ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineIDBefore / after: the XML example
This is the spot in question before and after the fix (Cross Industry Invoice, ZUGFeRD/Factur-X).
<ram:IncludedSupplyChainTradeLineItem>
<ram:SpecifiedTradeProduct>
<ram:Name>Beratung</ram:Name>
</ram:SpecifiedTradeProduct>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>1</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:Name>Beratung</ram:Name>
</ram:SpecifiedTradeProduct>
</ram:IncludedSupplyChainTradeLineItem>
Frequent questions about BR-21
Must the line identifier be a number?
May line numbers repeat?
Related error codes
Check BR-21 automatically
Instead of digging through the XML by hand you can validate your ZUGFeRD or XRechnung file online – upload the PDF or the XML and you get every error with rule ID, affected field, fix and XPath, as a readable report or as JSON through the API.