# PEPPOL-EN16931-R101

Source: https://xmlvalid.com/rules/PEPPOL-EN16931-R101

> Element Document reference can only be used for Invoice line object

- Level: error
- Rule sets: Peppol BIS Billing 3.0 rules 3.0.21, XRechnung 3.0 rules (UBL) 2.6.0
- Context: `cac:InvoiceLine | cac:CreditNoteLine`
- Test: `(not(cac:DocumentReference) or (cac:DocumentReference/cbc:DocumentTypeCode='130'))`

> Element Additional referenced document can only be used for Invoice line object.

- Level: error
- Rule sets: XRechnung 3.0 rules (CII) 2.6.0
- Context: `ram:IncludedSupplyChainTradeLineItem`
- Test: `(not(ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument) or (ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument/ram:TypeCode='130'))`

## Why it fails

- A line has a `cac:DocumentReference` whose `cbc:DocumentTypeCode` is not `130`, such as a delivery note or an order reference.

## How to fix it

- On a line, `cac:DocumentReference` is only for the invoiced object identifier, with `cbc:DocumentTypeCode` `130`. A line's order reference goes in `cac:OrderLineReference/cbc:LineID`.

Validate a document against these rules: https://xmlvalid.com/validate
