# createPurchaseOrder

## Overview

Creates a new purchase order in DRAFT status with supplier, currency, receiving site, and line items.

## Modules Commands Used

- [purchase] CreatePurchaseOrder

## Exception Handling

| Error Code | Description |
| --- | --- |
| PURCHASE_COMPANY_NOT_FOUND | The specified company does not exist |
| PURCHASE_CURRENCY_MISMATCH | The currency is not the company's base currency |
| PURCHASE_SUPPLIER_NOT_FOUND | The specified supplier does not exist |
| PURCHASE_SUPPLIER_NOT_ACTIVE | The specified supplier is not in active status |
| PURCHASE_PARTNER_NOT_SUPPLIER | The specified partner is not designated as a supplier |
| PURCHASE_EMPTY_PURCHASE_ORDER_LINES | No line items were provided |
| PURCHASE_ITEM_NOT_FOUND | A referenced item does not exist |
| PURCHASE_ITEM_NOT_ACTIVE | A referenced item is not in active status |
| PURCHASE_ITEM_NOT_PURCHASABLE | A referenced item has no purchasing record |
| PURCHASE_INVALID_QUANTITY | Line item quantity is zero or negative |
| PURCHASE_INVALID_UNIT_PRICE | Line item unit price is zero or negative |
| PURCHASE_RECEIVING_SITE_NOT_FOUND | The specified receiving site does not exist |
| PURCHASE_RECEIVING_SITE_REQUIRED | Receiving site is mandatory but was not provided |
