offdataai
SAP · data model template

SAP Procure-to-Pay Analytics data model

Kimball warehouse for SAP P2P: transaction-grain PO lines, goods receipts, and invoice receipts with SAP document numbers (ebeln/mblnr/belnr) as degenerate dimensions for three-way match, plus a daily AP open-item periodic snapshot with aging. Conformed MM/FI-AP dimensions; vendor tax IDs are classified restricted and masked; SAP fiscal year/period (gjahr/poper) drives period reporting.

SAP Materials Management (MM) and FI Accounts Payable procure-to-pay analytics migrated from ECC / S/4HANA into Snowflake. Covers the purchase order (EKKO/EKPO), goods receipt (MSEG/MKPF, movement 101), and logistics invoice (RBKP/RSEG) processes supporting three-way match, plus a daily AP open-item snapshot, over conformed vendor (LFA1, SCD2), material, plant (T001W), purchasing-org, and company-code dimensions. It is a Kimball dimensional model: fact tables at a declared grain surrounded by conformed dimensions, ready for BI tools and a semantic layer.

KimballSAPSOXGDPRIFRS
12
tables
136
columns
23
relationships
4
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

purchasinggoods_receiptinvoice_verificationaccounts_payableconformed_dimensions

Design decisions

  • Three transaction facts supporting the three-way match

    SAP P2P reconciles PO (EKKO/EKPO), goods receipt (MSEG/MKPF), and invoice (RBKP/RSEG); modelling each as a conformed transaction-grain fact lets quantity and price variances be computed by drilling across shared vendor/material/plant dimensions.

  • Goods-receipt fact keyed on movement type 101

    MM-IM records receipts as material-document movements; isolating bwart 101 (GR for PO) with its 102 reversal flag gives a clean received-quantity/value fact that ties to the PO via ebeln/ebelp.

  • Daily AP open-item periodic snapshot with aging

    Open payables (BSIK) are semi-additive balances needed daily for cash and DPO reporting; a periodic snapshot with aging buckets supplements the invoice transaction fact independent of posting volume.

  • SCD2 on the vendor master

    LFA1/LFB1 attributes (account group, payment terms, reconciliation account, blocked status) change over time; type-2 history preserves the as-was vendor classification required for SOX-compliant spend analysis.

Tables in the SAP Procure-to-Pay 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 (4)

fct_purchase_order_line

Grain: one row per purchase order item (EKKO/EKPO)

Transaction-grain MM fact at PO item level.

ColumnTypeKeys
purchase_order_line_keybigintPK
date_keybigint
fiscal_period_keybigint
vendor_keybigint
material_keybigint
plant_keybigint
purchasing_org_keybigint
company_code_keybigint
purchasing_doc_type_keybigint
delivery_date_keybigint
purchasing_documentvarchar
purchasing_itemvarchar
po_quantitydecimal
order_unitvarchar
net_pricedecimal
net_order_valuedecimal
document_currencyvarchar
account_assignment_categoryvarchar
item_categoryvarchar
is_deletedboolean

fct_goods_receipt

Grain: one row per goods-receipt material-document line (MSEG/MKPF, bwart 101)

Transaction-grain inventory-receipt leg of P2P.

ColumnTypeKeys
goods_receipt_keybigintPK
date_keybigint
fiscal_period_keybigint
vendor_keybigint
material_keybigint
plant_keybigint
company_code_keybigint
material_documentvarchar
material_doc_itemvarchar
reference_purchasing_documentvarchar
reference_purchasing_itemvarchar
movement_typevarchar
received_quantitydecimal
entry_unitvarchar
received_valuedecimal
document_currencyvarchar
is_reversalboolean

fct_invoice_receipt

Grain: one row per logistics-invoice item (RBKP/RSEG)

Transaction-grain invoice-verification leg of P2P (three-way match).

ColumnTypeKeys
invoice_receipt_keybigintPK
date_keybigint
fiscal_period_keybigint
vendor_keybigint
material_keybigint
company_code_keybigint
invoice_documentvarchar
invoice_itemvarchar
reference_purchasing_documentvarchar
reference_purchasing_itemvarchar
invoiced_quantitydecimal
invoice_amountdecimal
tax_amountdecimal
document_currencyvarchar
price_variance_amountdecimal
quantity_variancedecimal
is_blocked_for_paymentboolean

fct_ap_open_item_snapshot

Grain: one row per open AP item per day (periodic snapshot)

Daily periodic snapshot of open AP liabilities — semi-additive.

ColumnTypeKeys
date_keybigint
fiscal_period_keybigint
vendor_keybigint
company_code_keybigint
net_due_date_keybigint
accounting_documentvarchar
accounting_itemvarchar
open_amountdecimal
open_amount_documentdecimal
document_currencyvarchar
days_outstandinginteger
days_overdueinteger
aging_bucketvarchar
is_overdueboolean

Dimension tables (7)

dim_date

Grain: one row per calendar day

ColumnTypeKeys
date_keybigintPK
full_datedateBK
day_of_monthsmallint
month_numbersmallint
month_namevarchar
quartersmallint
yearsmallint
is_business_dayboolean
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
is_special_periodboolean
period_statusvarchar

dim_vendor

Grain: one row per vendor per SCD2 version

SCD type 2

ColumnTypeKeys
vendor_keybigintPK
vendor_numbervarcharBK
vendor_namevarcharPII
search_termvarchar
street_addressvarcharPII
cityvarchar
regionvarchar
postal_codevarcharPII
countryvarchar
tax_numbervarcharPII
account_groupvarchar
vendor_classvarchar
payment_termsvarchar
reconciliation_accountvarchar
is_one_time_vendorboolean
is_blockedboolean
is_activeboolean

dim_material

Grain: one row per material per SCD2 version

SCD type 2

ColumnTypeKeys
material_keybigintPK
material_numbervarcharBK
material_descriptionvarchar
material_typevarchar
material_groupvarchar
base_unit_of_measurevarchar
purchasing_groupvarchar
is_activeboolean

dim_plant

Grain: one row per plant

ColumnTypeKeys
plant_keybigintPK
plantvarcharBK
plant_namevarchar
cityvarchar
countryvarchar
company_codevarchar
purchasing_orgvarchar

dim_purchasing_org

Grain: one row per purchasing organization / group

ColumnTypeKeys
purchasing_org_keybigintPK
purchasing_orgvarcharBK
purchasing_org_namevarchar
purchasing_groupvarchar
purchasing_group_namevarchar
company_codevarchar

dim_company_code

Grain: one row per SAP company code

ColumnTypeKeys
company_code_keybigintPK
company_codevarcharBK
company_namevarchar
countryvarchar
local_currencyvarchar
chart_of_accountsvarchar
fiscal_year_variantvarchar

Lookup tables (1)

dim_purchasing_doc_type

Grain: one row per SAP purchasing document type

ColumnTypeKeys
purchasing_doc_type_keybigintPK
doc_typevarcharBK
doc_type_namevarchar
doc_categoryvarchar
is_framework_orderboolean

Relationships

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

  • fct_purchase_order_line.date_key → dim_date (many-to-one)
  • fct_purchase_order_line.fiscal_period_key → dim_fiscal_period (many-to-one)
  • fct_purchase_order_line.vendor_key → dim_vendor (many-to-one)
  • fct_purchase_order_line.material_key → dim_material (many-to-one)
  • fct_purchase_order_line.plant_key → dim_plant (many-to-one)
  • fct_purchase_order_line.purchasing_org_key → dim_purchasing_org (many-to-one)
  • fct_purchase_order_line.company_code_key → dim_company_code (many-to-one)
  • fct_purchase_order_line.purchasing_doc_type_key → dim_purchasing_doc_type (many-to-one)
  • fct_goods_receipt.date_key → dim_date (many-to-one)
  • fct_goods_receipt.fiscal_period_key → dim_fiscal_period (many-to-one)
  • fct_goods_receipt.vendor_key → dim_vendor (many-to-one)
  • fct_goods_receipt.material_key → dim_material (many-to-one)
  • fct_goods_receipt.plant_key → dim_plant (many-to-one)
  • fct_goods_receipt.company_code_key → dim_company_code (many-to-one)
  • fct_invoice_receipt.date_key → dim_date (many-to-one)
  • fct_invoice_receipt.fiscal_period_key → dim_fiscal_period (many-to-one)
  • fct_invoice_receipt.vendor_key → dim_vendor (many-to-one)
  • fct_invoice_receipt.material_key → dim_material (many-to-one)
  • fct_invoice_receipt.company_code_key → dim_company_code (many-to-one)
  • fct_ap_open_item_snapshot.date_key → dim_date (many-to-one)
  • fct_ap_open_item_snapshot.fiscal_period_key → dim_fiscal_period (many-to-one)
  • fct_ap_open_item_snapshot.vendor_key → dim_vendor (many-to-one)
  • fct_ap_open_item_snapshot.company_code_key → dim_company_code (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