offdataai
SAP · data model template

SAP Product Cost & Production Variance Analytics data model

Kimball warehouse for SAP CO-PC product costing: a standard cost component split fact (KEKO/KEPH) at material × plant × costing-run × cost-component grain carrying fixed/variable portions and MBEW prices, plus a production-order variance/settlement fact (aggregated from COEP) at production-order × cost-element × variance-category grain carrying target/actual/total variance, scrap, WIP, and settled amounts. The cost component is a conformed dimension so the cost structure is drillable; the variance category dimension classifies each settlement variance; material is SCD2 to preserve as-was costing attributes; costing numbers and order/settlement documents are degenerate dimensions for SOX-auditable, IFRS-compliant inventory valuation and margin analysis.

SAP Product Cost Controlling (CO-PC) analytics migrated from ECC / S/4HANA into Snowflake. Models two facts at different grains: the released standard cost estimate cost component split (KEKO header + KEPH cost component structure elehk, with fixed/variable portions, valued against MBEW standard/moving-average price) at material × plant × costing-run × cost-component grain; and production-order variance / settlement (actuals aggregated from COEP line items — COSP/COSS totals are gone in S/4HANA — with AUFK + AFKO order master) broken out by SAP variance category (input price/quantity, resource-usage, lot-size, scrap, output-price, remaining/mixed) including WIP and amounts settled to FI and CO-PA. Conformed material (MARA, SCD2), plant (T001W), production order, cost component, cost element (kstar), variance category, costing run (klvar), and profit-center dimensions with SAP fiscal-period accounting. It is a Kimball dimensional model: fact tables at a declared grain surrounded by conformed dimensions, ready for BI tools and a semantic layer.

KimballSAPSOXIFRS
12
tables
115
columns
16
relationships
0
PII columns

Opening the template creates a project with the ERD, platform-native DDL, a dbt project and documentation already generated (recommended platform: Snowflake). Edit it in plain English or on the canvas, then ship it to any supported warehouse.

Subject areas

product_costingproduction_varianceconformed_dimensions

Design decisions

  • Cost component split modelled as a conformed cost-component dimension

    The SAP cost component structure (KEKO.elehk → KEPH) decomposes a material's standard cost into raw material, labor, machine, overhead, and external-processing components with fixed/variable portions; modelling cost component as a dimension and putting the value on the fact lets analysts drill the cost structure and reconcile it to the same components on production variances.

  • Two separate facts at different grains: estimate vs variance

    The standard cost estimate (KEKO/KEPH) and production-order actuals/variances (COEP) have fundamentally different grains and event semantics — a periodic released estimate versus per-period order settlement; splitting them into two conformed-dimension facts avoids a mixed-grain table while still allowing target-vs-actual analysis across the shared cost-component, material, and plant dimensions.

  • Variance-category dimension for the SAP variance scheme

    SAP calculates production variances in fixed categories (input price, input quantity, resource-usage, lot-size, scrap, output-price, remaining/mixed-price); making variance category a dimension keeps the variance fact at one additive grain and lets the report pivot by category and sign convention rather than spreading category-specific measure columns across the fact.

  • SCD2 on material

    Material master attributes that drive costing (material type, procurement type, product hierarchy, MRP controller) change over time; type-2 history preserves the as-was material configuration so a cost estimate or variance can be analysed against the material setup that was effective when it was costed.

  • Settlement and WIP measures linked toward FI and CO-PA

    Production-order variances are settled to FI (price-difference accounts / inventory) and to CO-PA, and unsettled orders carry WIP at period end; carrying settled_amount, wip_amount, and a profit-center key on the variance fact captures the settlement linkage and keeps the mart reconcilable to the general ledger and profitability analysis for SOX and IFRS inventory valuation.

Tables in the SAP Product Cost & Production Variance Analytics model

Every table with its grain, columns, types and keys. PK marks a primary key, BK a business key and PII a column classified as personal data, which gets a masking strategy by default.

Fact tables (2)

fct_product_cost_estimate

Grain: one row per material × plant × costing run × cost component (KEKO/KEPH cost component split)

Cost-component-grain standard cost estimate fact — drillable cost structure split.

ColumnTypeKeys
product_cost_estimate_keybigintPK
valid_from_date_keybigint
fiscal_period_keybigint
material_keybigint
plant_keybigint
cost_component_keybigint
costing_run_keybigint
cost_element_keybigint
costing_numbervarchar
costing_versionvarchar
total_costdecimal
fixed_portiondecimal
variable_portiondecimal
standard_pricedecimal
moving_average_pricedecimal
costing_lot_sizedecimal
price_unitdecimal
currencyvarchar

fct_production_order_variance

Grain: one row per production order × cost element/cost component × variance category (COEP settlement/variance)

Variance-category-grain production order settlement fact — variance + WIP analysis.

ColumnTypeKeys
production_order_variance_keybigintPK
fiscal_period_keybigint
posting_date_keybigint
material_keybigint
plant_keybigint
production_order_keybigint
cost_component_keybigint
cost_element_keybigint
variance_category_keybigint
profit_center_keybigint
order_numbervarchar
settlement_documentvarchar
target_costdecimal
actual_costdecimal
planned_costdecimal
total_variancedecimal
control_costdecimal
scrap_costdecimal
wip_amountdecimal
settled_amountdecimal
target_quantitydecimal
actual_quantitydecimal
currencyvarchar

Dimension tables (10)

dim_date

Grain: one row per calendar day

ColumnTypeKeys
date_keybigintPK
full_datedateBK
day_of_monthsmallint
month_numbersmallint
month_namevarchar
quartersmallint
yearsmallint
is_period_endboolean

dim_fiscal_period

Grain: one row per SAP fiscal year/period (gjahr/monat)

ColumnTypeKeys
fiscal_period_keybigintPK
fiscal_period_codevarcharBK
fiscal_yearsmallint
fiscal_periodsmallint
fiscal_variantvarchar
period_start_datedate
period_end_datedate
period_statusvarchar

dim_material

Grain: one row per material per SCD2 version (matnr)

SCD type 2

ColumnTypeKeys
material_keybigintPK
material_numbervarcharBK
descriptionvarchar
material_typevarchar
material_groupvarchar
base_unitvarchar
product_hierarchyvarchar
procurement_typevarchar
mrp_controllervarchar
is_activeboolean

dim_plant

Grain: one row per SAP plant / valuation area

ColumnTypeKeys
plant_keybigintPK
plantvarcharBK
plant_namevarchar
company_codevarchar
valuation_areavarchar
countryvarchar
costing_sheetvarchar

dim_production_order

Grain: one row per production / process order (aufnr, AUFK + AFKO)

ColumnTypeKeys
production_order_keybigintPK
order_numbervarcharBK
order_typevarchar
order_categoryvarchar
descriptionvarchar
mrp_controllervarchar
production_supervisorvarchar
order_statusvarchar
routingvarchar
bomvarchar

dim_cost_component

Grain: one row per cost component within the cost component structure

ColumnTypeKeys
cost_component_keybigintPK
cost_componentvarcharBK
cost_component_structurevarchar
descriptionvarchar
cost_component_groupvarchar
is_fixed_cost_componentboolean
is_variableboolean

dim_cost_element

Grain: one row per cost element / GL account (kstar)

ColumnTypeKeys
cost_element_keybigintPK
cost_elementvarcharBK
descriptionvarchar
cost_element_categoryvarchar
cost_element_groupvarchar

dim_variance_category

Grain: one row per SAP production variance category

ColumnTypeKeys
variance_category_keybigintPK
variance_category_codevarcharBK
variance_labelvarchar
variance_typevarchar
is_favorable_sign_conventionboolean
sort_ordersmallint

dim_costing_run

Grain: one row per costing run (costing variant klvar + run id)

ColumnTypeKeys
costing_run_keybigintPK
costing_runvarcharBK
costing_variantvarchar
costing_versionvarchar
costing_typevarchar
valuation_variantvarchar
costing_date_fromdate
costing_date_todate

dim_profit_center

Grain: one row per profit center (prctr, CEPC)

ColumnTypeKeys
profit_center_keybigintPK
profit_centervarcharBK
namevarchar
controlling_areavarchar
segmentvarchar

Relationships

Each relationship is a foreign key on the first table referencing the second.

  • fct_product_cost_estimate.valid_from_date_key → dim_date (many-to-one)
  • fct_product_cost_estimate.fiscal_period_key → dim_fiscal_period (many-to-one)
  • fct_product_cost_estimate.material_key → dim_material (many-to-one)
  • fct_product_cost_estimate.plant_key → dim_plant (many-to-one)
  • fct_product_cost_estimate.cost_component_key → dim_cost_component (many-to-one)
  • fct_product_cost_estimate.costing_run_key → dim_costing_run (many-to-one)
  • fct_product_cost_estimate.cost_element_key → dim_cost_element (many-to-one)
  • fct_production_order_variance.fiscal_period_key → dim_fiscal_period (many-to-one)
  • fct_production_order_variance.posting_date_key → dim_date (many-to-one)
  • fct_production_order_variance.material_key → dim_material (many-to-one)
  • fct_production_order_variance.plant_key → dim_plant (many-to-one)
  • fct_production_order_variance.production_order_key → dim_production_order (many-to-one)
  • fct_production_order_variance.cost_component_key → dim_cost_component (many-to-one)
  • fct_production_order_variance.cost_element_key → dim_cost_element (many-to-one)
  • fct_production_order_variance.variance_category_key → dim_variance_category (many-to-one)
  • fct_production_order_variance.profit_center_key → dim_profit_center (many-to-one)

Related templates

All templates →
Start for $1

From requirements to AI-ready context, in one platform.

Describe your business in a conversation, start from a template or connect your own database. Your first model is ready in minutes.

Get startedBook a demo

Plans from $1/month · cancel any time