SAP Reference
CO15
CreateS/4 · ActiveEnter Confirmation (Order)
Boilerplate SQL
Databricks SQLStarting point for querying the tables behind this transaction. Adjust the WHERE clause for your scenario.
-- ============================================================
-- T-Code : CO15 Enter Confirmation (Order)
-- Purpose: Confirm final GR on a production order; may backflush components and post material documents
-- Grain : One row per confirmation with optional material-document enrichment
-- Tables : AFRU, MSEG, MKPF, MAKT, T001W
-- Notes : CO15 writes AFRU + (on backflush) MKPF/MSEG. AFRU and MSEG are linked only by AUFNR — bridge them on order number + confirmation posting date.
-- ============================================================
SELECT
-- Keys
a.MANDT AS "Client",
a.RUECK AS "Confirmation Number",
a.AUFNR AS "Order Number",
a.VORNR AS "Operation Number",
l.MBLNR AS "Material Document",
l.MJAHR AS "Material Doc Year",
l.ZEILE AS "Material Doc Item",
-- Descriptive text
mt.MAKTX AS "Material Description",
-- Quantities + UOM (paired)
a.LMNGA AS "Yield",
a.XMNGA AS "Scrap",
a.MEINH AS "Confirmation UoM",
l.MENGE AS "Movement Quantity",
l.MEINS AS "Movement UoM",
-- Dates
a.BUDAT AS "Confirmation Posting Date",
h.BUDAT AS "Material Doc Posting Date",
a.ISDD AS "Actual Start",
a.IEDD AS "Actual Finish",
-- Status / indicators
a.STOKZ AS "Reversal Indicator",
l.BWART AS "Movement Type",
l.SHKZG AS "Debit/Credit Indicator",
-- Org fields
a.WERKS AS "Plant",
pt.NAME1 AS "Plant Name",
l.LGORT AS "Storage Location",
-- Master data enrichment
l.MATNR AS "Material Number",
a.AUFPL AS "Routing Number",
a.APLZL AS "Operation General Counter",
a.ERNAM AS "Entered By"
FROM afru a
LEFT JOIN mseg l
ON l.MANDT = a.MANDT
AND l.AUFNR = a.AUFNR
AND l.BWART IN ('261','262','531','532','101','102')
LEFT JOIN mkpf h
ON h.MANDT = l.MANDT
AND h.MBLNR = l.MBLNR
AND h.MJAHR = l.MJAHR
AND h.BUDAT = a.BUDAT
LEFT JOIN makt mt
ON mt.MANDT = l.MANDT
AND mt.MATNR = l.MATNR
AND mt.SPRAS = 'E'
LEFT JOIN t001w pt
ON pt.MANDT = a.MANDT
AND pt.WERKS = a.WERKS
WHERE
a.MANDT = '100'
AND a.AUFNR = '<AUFNR>'
AND a.STOKZ = ''
ORDER BY a.BUDAT DESC, a.RUECK, l.ZEILE;Tables Used by This Transaction
How these tables connect. Nodes are clickable.