# cancelPurchaseOrder

## Overview

Cancels a purchase order in DRAFT, SUBMITTED, or ORDERED status, transitioning orderStatus to CANCELLED. Cancellation is blocked if posted inbound shipments or registered vendor invoices exist for the order.

## Modules Commands Used

- [purchase] CancelPurchaseOrder

## Exception Handling

| Error Code | Description |
| --- | --- |
| PURCHASE_PURCHASE_ORDER_NOT_FOUND | The specified purchase order does not exist |
| PURCHASE_PURCHASE_ORDER_NOT_CANCELLABLE | The purchase order status does not allow cancellation (already CANCELLED or CLOSED) |
| PURCHASE_PURCHASE_ORDER_ALREADY_FULFILLED | Posted inbound shipments or registered vendor invoices exist for this order |
