W113: Get purchase order detail
Returns a single PO with everything the detail page needs to render in one round-trip. Triggered by clicking a PO in the list.
Steps
-
Load the PO header. Call
PurchaseOrders.getPoById. The L2 op returns the header plus the same computedexpectedTotalandactualTotalfields described in W112. -
Load items with received-quantity rollup. Call
PurchaseOrders.listItemsByPo. Each item carries a derivedreceivedQuantitysummed frompo_receipt_itemsso the page can show line-level progress. -
Batch-load related rows. Vendor, ship-to location, and the catalog rows (materials for materials POs, SKUs for FG POs) referenced by the items.
-
Merge into a hydrated view. Single combined payload, ready for the page to render.
Returns
The PO header (with expectedTotal and actualTotal) plus items (with receivedQuantity), vendor, location, and referenced catalog rows.
Business rules
- Single payload by design. All shared dropdown data (status types, etc.) comes from separate workflows; this one returns only the PO and its direct references.
- Receipts themselves are a separate read. Use W123 (List receipts for a PO) or W124 (Get receipt detail) for the receipt-side data; this workflow does not embed receipts in the response.
Errors
NotFoundError. The PO was not found.