> For the complete documentation index, see [llms.txt](https://smart-connected-supplier-network.gitbook.io/processmanual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smart-connected-supplier-network.gitbook.io/processmanual/use-cases/order-items-under-a-purchase-contract.md).

# Order Items under a Purchase Contract

In this use-case it is explained how to order a standard item within the context of a purchase contract using the order message

## Introduction

In complex supply chains where many different products are purchased in relatively small quantities, companies often set up long-term agreements with their suppliers.

A **Purchase Contract** is an agreement that defines how a supplier will provide specific products or services over a longer period of time. It is typically used for expensive items or products that take a long time to manufacture and deliver.

This type of agreement benefits both the buyer and the supplier:

**Benefits for the Buyer**

* Lower purchase prices through long-term commitments.
* Faster delivery when orders are placed because products or materials are already planned.
* Reduced internal lead times, allowing the organization to respond more quickly to business needs.

**Benefits for the Supplier**

* Greater certainty about future demand and expected order volumes.
* Better visibility of upcoming business, making production and planning easier.
* More flexibility to schedule manufacturing efficiently while meeting agreed delivery commitments.

## Message Instructions

The buyer issues a blanket purchase order via an Order message containing the specific article number, quantity, contracted price, and the required delivery date. Crucially, the order needs to reference the active contract properly.

If a single contract applies to the entire order, it can be specified at the Header level within the Contract-node.

To reference a contract at the line level, the `DocumentReference` element must be used directly under the `OrderLine` (and **NOT** inside the `LineItem` element).

If a contract reference is provided on both header as line level, then the contract reference on the line level overrules the contract reference on header level.

### Order-Level Reference Example (Single Contract for Whole Order)

XML:

```xml
<Order xmlns="urn:oasis:names:specification:ubl:schema:xsd:Order-2" ...>
    <cbc:ID>ORD-2026-00412</cbc:ID>
    ...
    
    <!-- Contract reference at Header level -->
    <cac:Contract>
        <cac:ContractDocumentReference>
            <cbc:ID>CON-2026-8841</cbc:ID>
        </cac:ContractDocumentReference>
    </cac:Contract>
    
    ...
</Order>
```

### Order Line-Level Reference Example (Contract per OrderLine)

XML:

```xml
<cac:OrderLine>
    <cac:LineItem>
        <cbc:ID>1</cbc:ID>
        <cbc:Quantity unitCode="EA">250</cbc:Quantity>
        <cac:Price>
            <cbc:PriceAmount currencyID="EUR">4.50</cbc:PriceAmount>
        </cac:Price>
        <cac:Item>
            <cac:SellersItemIdentification>
                <cbc:ID>ART-99234-X</cbc:ID>
            </cac:SellersItemIdentification>
        </cac:Item>
    </cac:LineItem>
    
    <!-- Correct mapping: DocumentReference directly under OrderLine (NOT inside LineItem) -->
    <cac:DocumentReference>
        <cbc:ID>CON-2026-9915</cbc:ID>
        <cbc:DocumentType>Contract</cbc:DocumentType>
    </cac:DocumentReference>
</cac:OrderLine>
```
