SAP Reference
CO01
Create S/4HANA status: ActiveCreate Production Order
What the badges mean
- S/4HANA status: Active
- Active and unchanged in S/4HANA.
- S/4HANA status: Deprecated
- Still readable today, but no longer SAP's strategic path — plan around it.
- S/4HANA status: Replaced
- Replaced by a new persistence in S/4HANA; the classic name may still answer reads (see read mechanism).
- S/4HANA status: Migrating to IBP
- Planning scope is moving from APO toward IBP.
- S/4HANA status: Active (StRM) · Replaced (EWM)
- Path-dependent: active with SAP Stock Room Management, replaced where EWM is the warehouse path.
- S/4HANA status: Replaced · Compat View
- Compatibility view: the classic table name is redirected to a view over the new persistence — see how the physical model moved.
- S/4HANA status: Active · Proxy View
- Proxy view: reads route through NSDM proxy/CDS views — see how the physical model moved.
- master
- Data class: what the table holds — master data, transaction documents, org structure, config, or texts (one row per language — see the quirks guide).
In field listings, K marks a primary-key field, and linked type codes in the Type column jump to the matching quirks-guide section.
Boilerplate SQL
Databricks SQLStarting point for querying the tables behind this transaction. Set your Unity Catalog location and filter values below — they’re substituted into the SQL and the copy button.
Query parameters
7 parameters not filled: <catalog>, <schema>, <MANDT>, <DATE_FROM>, <DATE_TO>, <WERKS>, <AUFNR>
-- ============================================================
-- T-Code : CO01 Create Production Order
-- Purpose: Create a production order with header, item, and operations
-- Grain : One row per production order with first-line item and operation
-- Tables : AFKO, AFPO, AUFK, AFVC, MAKT, MARA, T001W
-- Notes : AFVC joins to AFKO via AUFPL (routing number), NOT AUFNR — otherwise you get a Cartesian product on operations. Status evaluation requires JEST + TJ02T lookup (see JEST trick at end).
-- ============================================================
SELECT
-- Keys
h.MANDT AS "Client",
h.AUFNR AS "Order Number",
l.POSNR AS "Order Item",
-- Descriptive text
ord.KTEXT AS "Short Text",
mt.MAKTX AS "Material Description",
-- Quantities + UOM (paired)
h.GAMNG AS "Total Order Quantity",
h.GMEIN AS "Order Unit of Measure",
l.PSMNG AS "Item Quantity",
l.WEMNG AS "Delivered Quantity",
(l.PSMNG - l.WEMNG) AS "Open Quantity",
l.PAMNG AS "Scrap Quantity",
-- Dates
h.GSTRP AS "Basic Start Date",
h.GLTRP AS "Basic Finish Date",
h.GSTRS AS "Scheduled Start",
h.GLTRS AS "Scheduled Finish",
h.FTRMI AS "Actual Release Date",
ord.ERDAT AS "Created On",
-- Status / indicators
ord.OBJNR AS "Object Number (JEST/TJ02T)",
ord.USER0 AS "User Status",
-- Org fields
l.DWERK AS "Plant",
pt.NAME1 AS "Plant Name",
ord.BUKRS AS "Company Code",
h.FEVOR AS "Production Scheduler",
-- Master data enrichment
ord.AUART AS "Order Type",
h.PLNBEZ AS "Material Number",
m.MTART AS "Material Type",
m.MATKL AS "Material Group",
h.DISPO AS "MRP Controller",
h.PLNNR AS "Routing Group",
h.PLNAL AS "Group Counter"
FROM <catalog>.<schema>.afko h
INNER JOIN <catalog>.<schema>.afpo l
ON l.MANDT = h.MANDT
AND l.AUFNR = h.AUFNR
INNER JOIN <catalog>.<schema>.aufk ord
ON ord.MANDT = h.MANDT
AND ord.AUFNR = h.AUFNR
LEFT JOIN <catalog>.<schema>.makt mt
ON mt.MANDT = l.MANDT
AND mt.MATNR = l.MATNR
AND mt.SPRAS = 'E'
LEFT JOIN <catalog>.<schema>.mara m
ON m.MANDT = l.MANDT
AND m.MATNR = l.MATNR
LEFT JOIN <catalog>.<schema>.t001w pt
ON pt.MANDT = l.MANDT
AND pt.WERKS = l.DWERK
WHERE
h.MANDT = '<MANDT>'
AND ord.ERDAT BETWEEN '<DATE_FROM>' AND '<DATE_TO>'
-- AND l.DWERK = '<WERKS>'
-- AND h.AUFNR = '<AUFNR>'
ORDER BY h.GLTRP, h.AUFNR;Tables Used by This Transaction
How these tables connect — join details in the list below.
R read · W write · R/W read + write