SAP Production Orders: Key Tables and Data Flow
Feb 3, 2025

SAP Production Orders: Key Tables and Data Flow

SAP Production Orders: Key Tables and Data Flow

A comprehensive guide to understanding production order data structures, lifecycle management, and practical query techniques for SAP PP consultants

Production orders are the backbone of SAP's Production Planning (PP) module, orchestrating manufacturing processes from material requirements to final confirmation. Understanding the underlying table structures and data relationships is essential for any SAP PP consultant working with production environments. This deep dive explores the critical tables that power production order management, their interdependencies, and practical approaches to extracting meaningful insights from your manufacturing data.

Understanding the Production Order Ecosystem

Before diving into specific tables, it's crucial to grasp how SAP organizes production order data. Unlike simpler transactional systems, SAP PP distributes production order information across multiple interconnected tables, each serving a distinct purpose in the manufacturing lifecycle. This normalized structure enables efficient data storage while maintaining complex relationships between orders, operations, materials, and confirmations.

The primary tables you'll work with include:

  • AUFK - Order Master Data (the central registry for all order types)
  • AFKO - Production Order Header (PP-specific header information)
  • AFPO - Order Item (material and quantity details)
  • AFRU - Order Confirmations (time tickets and yield reporting)
  • AFVC - Operation Details within Orders
  • RESB - Reservation/Dependent Requirements (component allocations)

Expert Insight:

AUFK serves as the universal order master for multiple order categories (CO, PM, PP, PS). Always filter by AUTYP = '10' to isolate production orders specifically, and check AUART for the order type configuration.

AUFK: The Order Master Foundation

Table AUFK (Auftragsköpfe - Order Headers) is the cornerstone of SAP's order management system. Every production order begins its life with an entry in AUFK, which contains fundamental identification and organizational data.

Critical Fields in AUFK

FieldDescriptionUsage Notes
AUFNROrder Number12-character unique identifier, typically numeric
AUARTOrder TypeDefines order category (e.g., ZP01, PP01)
AUTYPOrder CategoryUse '10' for production orders
WERKSPlantManufacturing location
ERDATCreated OnOrder creation date
AEDATChanged OnLast modification timestamp

While AUFK provides the foundational order data, it intentionally omits manufacturing-specific details. This design allows the same table structure to support various order types across CO, PM, and PP modules. For production-specific information, you must join to AFKO.

-- Basic production order retrieval from AUFK
SELECT aufnr,
       auart,
       werks,
       erdat,
       aedat
FROM aufk
WHERE autyp = '10'           -- Production orders only
  AND werks = '1000'         -- Specific plant
  AND erdat >= '20250101'    -- Created this year
ORDER BY aufnr DESC;

AFKO: Production Order Header Intelligence

AFKO (Auftragskopf - Order Header) contains the manufacturing-specific header data that transforms a generic order into a production order. This table holds scheduling information, production versions, and critical status indicators that drive shop floor execution.

Essential AFKO Fields

AFKO's field structure reveals SAP's production planning philosophy. Key fields include:

  • AUFNR - Order number (foreign key to AUFK)
  • GLTRP - Basic finish date (scheduled completion)
  • GSTRP - Basic start date (scheduled start)
  • FTRMS - Release date (when order was released)
  • GAMNG - Total order quantity
  • GMEIN - Unit of measure for order quantity
  • PLNBEZ - Task list (routing) number
  • PLNNR - Plan number
  • DISPO - MRP controller
  • FEVOR - Production scheduler

The relationship between scheduled dates (GSTRP/GLTRP) and actual dates reflects production planning accuracy. Monitoring these variances is essential for capacity planning and on-time delivery metrics.

-- Production orders with scheduling details
SELECT ak.aufnr,
       ak.auart,
       ak.werks,
       ko.gstrp AS basic_start_date,
       ko.gltrp AS basic_finish_date,
       ko.ftrms AS release_date,
       ko.gamng AS order_quantity,
       ko.gmein AS uom,
       ko.dispo AS mrp_controller
FROM aufk AS ak
INNER JOIN afko AS ko
  ON ak.aufnr = ko.aufnr
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND ko.gltrp BETWEEN '20250101' AND '20250331'
ORDER BY ko.gltrp ASC;

Performance Tip:

AFKO is a massive table in high-volume manufacturing environments. Always filter on indexed fields (AUFNR, GLTRP) and consider using secondary indexes on DISPO or FEVOR for MRP-controller-specific queries. Avoid full table scans.

AFPO: Order Items and Material Linkage

AFPO (Auftragspositionen - Order Items) represents the "what" of production orders - which materials are being produced, in what quantities, and with what specifications. While many production orders contain a single item, the table structure supports multi-item orders for co-products and by-products.

Key AFPO Structure

AFPO uses a composite key of AUFNR (order number) and POSNR (item number), allowing multiple materials per order. Critical fields include:

FieldDescriptionBusiness Significance
AUFNROrder NumberLinks to AUFK/AFKO
POSNRItem NumberTypically 0001 for main product
MATNRMaterial NumberFinished good being produced
PSMNGOrder QuantityTarget production quantity
WEMNGGoods Receipt QtyActual received quantity
MEINSBase UOMUnit of measure
DWERKDelivery PlantWhere material will be stocked

The relationship between PSMNG (planned quantity) and WEMNG (goods receipt quantity) reveals production efficiency and scrap rates. Monitoring this variance is critical for yield management and cost accounting.

-- Production orders with material and quantity details
SELECT ak.aufnr,
       ak.auart,
       po.posnr,
       po.matnr,
       po.psmng AS planned_qty,
       po.wemng AS received_qty,
       po.meins AS uom,
       CASE
         WHEN po.psmng > 0 THEN
           ROUND((po.wemng / po.psmng) * 100, 2)
         ELSE 0
       END AS yield_percentage,
       ko.gltrp AS finish_date
FROM aufk AS ak
INNER JOIN afko AS ko ON ak.aufnr = ko.aufnr
INNER JOIN afpo AS po ON ak.aufnr = po.aufnr
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND po.matnr LIKE 'FG%'  -- Finished goods pattern
ORDER BY ko.gltrp DESC;

AFRU: Production Confirmations and Reality

AFRU (Rückmeldungen - Confirmations) bridges the gap between planning and reality. This table captures time tickets, yield reporting, scrap documentation, and variance reasons - the actual execution data that drives costing and performance analysis.

AFRU Data Structure

Each confirmation creates a new AFRU record with a unique RUEMNG (confirmation number). Multiple confirmations can exist for a single operation, supporting partial confirmations and shift-based reporting.

Critical fields for manufacturing intelligence:

  • RUEMNG - Confirmation number (unique identifier)
  • AUFNR - Order number (links to production order)
  • VORNR - Operation number (which step was confirmed)
  • LMNGA - Yield quantity (good production)
  • XMNGA - Scrap quantity (rejected parts)
  • GMNGA - Confirmed quantity (total activity)
  • ISM01-ISM06 - Actual activity quantities (setup, machine, labor)
  • ILE01-ILE06 - Actual activity durations
  • BUDAT - Posting date
  • ERSDA - Creation date
  • STOKZ - Reversal indicator
-- Production confirmation analysis with yield and scrap
SELECT ru.aufnr,
       ru.ruemng AS confirmation_number,
       ru.vornr AS operation,
       ru.lmnga AS yield_qty,
       ru.xmnga AS scrap_qty,
       ru.gmnga AS total_confirmed,
       ru.ism01 AS setup_hours,
       ru.ism02 AS machine_hours,
       ru.ism03 AS labor_hours,
       ru.budat AS posting_date,
       po.matnr,
       po.psmng AS order_qty,
       CASE
         WHEN ru.stokz = 'X' THEN 'Reversed'
         ELSE 'Active'
       END AS confirmation_status
FROM afru AS ru
INNER JOIN afpo AS po
  ON ru.aufnr = po.aufnr
  AND po.posnr = '0001'  -- Main item
WHERE ru.aufnr IN (
  SELECT aufnr
  FROM aufk
  WHERE autyp = '10'
    AND werks = '1000'
)
  AND ru.stokz != 'X'  -- Exclude reversed confirmations
  AND ru.budat >= '20250101'
ORDER BY ru.budat DESC, ru.aufnr, ru.vornr;

Data Quality Consideration:

Always filter out reversed confirmations (STOKZ = 'X') when calculating production metrics. Including reversed records will corrupt yield calculations, efficiency metrics, and cost actuals. Many reporting issues stem from this oversight.

Production Order Lifecycle and Status Management

Understanding production order status progression is essential for accurate reporting and workflow automation. SAP manages order status through system status (JEST table) and user status (TJ30 configuration), creating a sophisticated state machine.

System Status Progression

The typical system status flow for a production order:

CRTD
Created - Initial state after order creation
REL
Released - Order released to shop floor
PREL
Partially Released - Some operations released
CNF
Confirmed - Production confirmed (partially or fully)
DLV
Delivered - Goods receipt posted
TECO
Technically Complete - Order closed for further postings
CLSD
Closed - Final business closure

Querying Order Status

Order status resides in the JEST (Object Status) table, which uses object number (OBJNR) as the key. AUFK.OBJNR links orders to their status records.

-- Production orders with current system status
SELECT ak.aufnr,
       ak.auart,
       po.matnr,
       ko.gltrp AS finish_date,
       je.stat AS status_code,
       je.inact AS inactive_flag,
       CASE je.stat
         WHEN 'I0001' THEN 'Created'
         WHEN 'I0002' THEN 'Released'
         WHEN 'I0009' THEN 'Confirmed'
         WHEN 'I0010' THEN 'Partially Confirmed'
         WHEN 'I0012' THEN 'Delivered'
         WHEN 'I0045' THEN 'TECO'
         WHEN 'I0046' THEN 'Closed'
         ELSE je.stat
       END AS status_description
FROM aufk AS ak
INNER JOIN afko AS ko ON ak.aufnr = ko.aufnr
INNER JOIN afpo AS po ON ak.aufnr = po.aufnr AND po.posnr = '0001'
INNER JOIN jest AS je ON ak.objnr = je.objnr
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND je.inact = ''  -- Active status only
  AND ko.gltrp >= '20250101'
ORDER BY ko.gltrp ASC;

Critical Query Pattern:

Always check je.inact = '' when querying JEST. The INACT field indicates whether a status is currently active. Orders accumulate status records over their lifecycle, but only active statuses (INACT = '') reflect the current state. Failing to filter on INACT will return historical statuses and corrupt your reports.

Practical Production Tracking Queries

Real-world production monitoring requires combining data across multiple tables. Here are battle-tested query patterns for common manufacturing scenarios.

1. Orders Behind Schedule

-- Production orders past due that are not TECO or Closed
SELECT ak.aufnr,
       ak.auart,
       po.matnr,
       po.psmng AS order_qty,
       po.wemng AS received_qty,
       ko.gltrp AS scheduled_finish,
       ko.dispo AS mrp_controller,
       DATEDIFF(day, ko.gltrp, CURRENT_DATE) AS days_overdue
FROM aufk AS ak
INNER JOIN afko AS ko ON ak.aufnr = ko.aufnr
INNER JOIN afpo AS po ON ak.aufnr = po.aufnr AND po.posnr = '0001'
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND ko.gltrp < CURRENT_DATE
  AND NOT EXISTS (
    SELECT 1 FROM jest
    WHERE objnr = ak.objnr
      AND stat IN ('I0045', 'I0046')  -- TECO or Closed
      AND inact = ''
  )
ORDER BY days_overdue DESC;

2. Production Efficiency by Material

-- Yield analysis: planned vs actual by material
SELECT po.matnr,
       COUNT(DISTINCT ak.aufnr) AS total_orders,
       SUM(po.psmng) AS total_planned_qty,
       SUM(po.wemng) AS total_received_qty,
       SUM(COALESCE(scrap.total_scrap, 0)) AS total_scrap_qty,
       CASE
         WHEN SUM(po.psmng) > 0 THEN
           ROUND((SUM(po.wemng) / SUM(po.psmng)) * 100, 2)
         ELSE 0
       END AS overall_yield_pct,
       CASE
         WHEN SUM(po.wemng) > 0 THEN
           ROUND((SUM(COALESCE(scrap.total_scrap, 0)) / SUM(po.wemng)) * 100, 2)
         ELSE 0
       END AS scrap_rate_pct
FROM aufk AS ak
INNER JOIN afko AS ko ON ak.aufnr = ko.aufnr
INNER JOIN afpo AS po ON ak.aufnr = po.aufnr AND po.posnr = '0001'
LEFT JOIN (
  SELECT aufnr, SUM(xmnga) AS total_scrap
  FROM afru
  WHERE stokz != 'X'
  GROUP BY aufnr
) AS scrap ON ak.aufnr = scrap.aufnr
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND ko.gltrp BETWEEN '20250101' AND '20250331'
  AND EXISTS (
    SELECT 1 FROM jest
    WHERE objnr = ak.objnr
      AND stat = 'I0045'  -- TECO
      AND inact = ''
  )
GROUP BY po.matnr
HAVING SUM(po.psmng) > 0
ORDER BY scrap_rate_pct DESC;

3. Daily Production Output

-- Daily production confirmations with yield
SELECT ru.budat AS production_date,
       po.matnr,
       COUNT(DISTINCT ru.aufnr) AS orders_confirmed,
       SUM(ru.lmnga) AS total_yield,
       SUM(ru.xmnga) AS total_scrap,
       SUM(ru.gmnga) AS total_confirmed,
       SUM(ru.ism02) AS total_machine_hours,
       SUM(ru.ism03) AS total_labor_hours,
       CASE
         WHEN SUM(ru.gmnga) > 0 THEN
           ROUND((SUM(ru.lmnga) / SUM(ru.gmnga)) * 100, 2)
         ELSE 0
       END AS yield_percentage
FROM afru AS ru
INNER JOIN afpo AS po ON ru.aufnr = po.aufnr AND po.posnr = '0001'
INNER JOIN aufk AS ak ON ru.aufnr = ak.aufnr
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND ru.stokz != 'X'
  AND ru.budat BETWEEN '20250901' AND '20250930'
GROUP BY ru.budat, po.matnr
ORDER BY ru.budat DESC, po.matnr;

Component Consumption and Material Flow

Production orders don't exist in isolation - they consume components and create finished goods. Understanding material flow requires exploring RESB (Reservations) and goods movement tables.

RESB: Component Allocations

When a production order is created, SAP generates reservation records in RESB for each component in the BOM. These reservations link raw materials to specific production orders and operations.

-- Component requirements for production orders
SELECT ak.aufnr,
       po.matnr AS finished_good,
       po.psmng AS fg_quantity,
       rb.matnr AS component,
       rb.bdmng AS required_qty,
       rb.enmng AS withdrawn_qty,
       rb.meins AS uom,
       rb.vornr AS operation,
       rb.lgort AS storage_location,
       CASE
         WHEN rb.bdmng > 0 THEN
           ROUND((rb.enmng / rb.bdmng) * 100, 2)
         ELSE 0
       END AS consumption_pct
FROM aufk AS ak
INNER JOIN afpo AS po ON ak.aufnr = po.aufnr AND po.posnr = '0001'
INNER JOIN resb AS rb ON ak.aufnr = rb.aufnr
WHERE ak.autyp = '10'
  AND ak.werks = '1000'
  AND ak.aufnr = '000012345678'  -- Specific order
ORDER BY rb.vornr, rb.matnr;

The difference between BDMNG (required quantity) and ENMNG (withdrawn quantity) reveals component shortage situations and over-consumption issues critical for material planning.

Advanced Integration Points

Production orders integrate with multiple SAP modules. Understanding these integration points is essential for comprehensive analysis.

Key Integration Tables

  • AFVC (Operations) - Individual operations within orders, linking to work centers (ARBPL) and control keys (STEUS). Essential for capacity planning and detailed scheduling.
  • AFFL (Sequences) - Production sequences and campaign management for process industries requiring ordered execution.
  • MSEG (Material Documents) - Goods movements for component issues (261) and finished good receipts (101), linking via AUFNR.
  • COEP (CO Line Items) - Cost postings, variances, and settlement documents for production order costing analysis.
  • CRHD/CRHH (Work Centers) - Capacity data and work center attributes for operations scheduled in AFVC.

Integration Best Practice:

When building comprehensive production reports, always consider the data source hierarchy: AUFK/AFKO/AFPO for planning data, AFRU for actuals, MSEG for material movements, and COEP for financial impacts. Each table serves a distinct purpose in the production narrative.

Performance Optimization Strategies

Production tables grow rapidly in high-volume manufacturing environments. A busy plant can generate millions of AFRU records annually. Query performance requires deliberate optimization.

Indexing Strategies

Leverage SAP's standard indexes:

  • AUFK: Primary on AUFNR, secondaries on WERKS, AUART, ERDAT
  • AFKO: Primary on AUFNR, critical secondaries on GLTRP, DISPO
  • AFPO: Composite primary on AUFNR + POSNR, secondary on MATNR
  • AFRU: Primary on RUEMNG, critical secondaries on AUFNR, BUDAT

Query Optimization Patterns

1. Always filter on indexed fields first

Use WERKS, date ranges (ERDAT, GLTRP, BUDAT), and AUFNR before joining to other tables.

2. Limit date ranges aggressively

Never query production tables without date restrictions. Even "last 12 months" can return millions of records.

3. Use EXISTS instead of IN for status checks

When filtering by order status in JEST, EXISTS subqueries outperform IN clauses significantly.

4. Consider materialized views for complex metrics

Production KPIs requiring multi-table aggregations should be pre-calculated and refreshed periodically rather than computed on-demand.

Common Data Quality Issues

Real-world production data contains inconsistencies that can corrupt analytics. Awareness of these patterns is essential for reliable reporting.

Orphaned Confirmations

AFRU records where the parent order has been deleted or the AUFNR is invalid. Always validate AUFNR existence in AUFK.

Reversed Confirmations Not Excluded

AFRU.STOKZ = 'X' indicates a reversed confirmation. Forgetting this filter is the #1 cause of inflated production metrics.

Zero Quantities

AFPO.PSMNG = 0 or AFRU.GMNGA = 0 can occur from data entry errors or system issues. These records skew yield calculations.

Inactive Status Records

JEST accumulates historical statuses. Always filter JEST.INACT = '' to get current status only.

Conclusion: Building Production Intelligence

Mastering SAP production order tables transforms raw transactional data into actionable manufacturing intelligence. The table structure - AUFK for order identification, AFKO for scheduling, AFPO for materials, and AFRU for actuals - creates a comprehensive digital twin of your production operations.

Effective production analysis requires understanding not just individual table structures, but their relationships and the lifecycle they support. Status management through JEST, material flow via RESB and MSEG, and cost impact through COEP create an interconnected ecosystem that reflects the complexity of modern manufacturing.

As you build production reports and analytics, remember these core principles:

  • Always filter production order category (AUTYP = '10') to isolate manufacturing orders
  • Exclude reversed confirmations (STOKZ != 'X') from all actual calculations
  • Use active status only (JEST.INACT = '') for current order states
  • Apply date range filters on indexed fields before complex joins
  • Validate data quality assumptions - production data is messy by nature

The queries and patterns presented here serve as starting points for your specific manufacturing scenarios. Every production environment has unique requirements - custom fields, Z-tables, industry-specific extensions. But the fundamental table relationships and data flows remain consistent across SAP implementations.

By deeply understanding these core production tables, you'll be equipped to diagnose data issues, build reliable analytics, and provide meaningful insights that drive operational improvements. The investment in mastering AUFK, AFKO, AFPO, and AFRU pays dividends in every production analysis you conduct.

Key Takeaways

  • AUFK provides order master data across all SAP modules; filter AUTYP = '10' for production orders
  • AFKO contains manufacturing-specific header data including scheduling and production versions
  • AFPO links orders to materials with planned and actual quantities for yield analysis
  • AFRU captures production confirmations, time tickets, and scrap - the source of truth for actuals
  • Order status management through JEST requires filtering on INACT = '' for current states
  • Always exclude reversed confirmations (STOKZ = 'X') from production metrics
  • Component consumption flows through RESB reservations and MSEG goods movements
  • Query performance requires aggressive filtering on indexed fields and date ranges