# CII-DT-024

Source: https://xmlvalid.com/rules/CII-DT-024

> ReferenceTypeCode should not be present

- Level: error
- Rule sets: EN 16931 rules (CII) 1.3.17, EN 16931 rules 1.3.16 (CII)
- Context: `//ram:*[ends-with(name(), 'ReferencedDocument')]`
- Test: `not(ram:ReferenceTypeCode) or (self::ram:AdditionalReferencedDocument and ram:TypeCode='130')`

## Why it fails

- A referenced document (an order, contract or preceding invoice reference) carries `ram:ReferenceTypeCode`, which EN 16931 uses only for an invoiced object identifier.

## How to fix it

- Remove `ram:ReferenceTypeCode` from the reference, or, if it identifies an invoiced object (BT-18), put it in an `ram:AdditionalReferencedDocument` with `ram:TypeCode` `130`.

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