SAP MM Tables Relationship Diagram as a Join Key Map (EKKO, MSEG, MARA, MATDOC)
To write a report on purchasing or inventory you need to know which tables link to which and on what keys. This map shows the common SAP MM relationships in one searchable list, from purchase requisition to purchase order to goods receipt to invoice, plus the material master and cost center links.
| From table | To table | Join keys | Business object and note |
|---|---|---|---|
EKKO | EKPO | EBELN | Purchase order header to items. Contracts and scheduling agreements use the same tables, told apart by document category BSTYP |
EKPO | EKET | EBELN, EBELP | PO item to schedule lines (delivery dates, scheduled quantity) |
EKPO | EKKN | EBELN, EBELP | PO item to account assignment; EKKN holds cost center (KOSTL), order, WBS |
EKPO | EKBE | EBELN, EBELP | PO item to purchase order history (goods receipts, invoice receipts) |
EKKO | LFA1 | LIFNR | PO header to vendor master general data |
EKKO | T001W | via EKPO-WERKS | Plant name for the PO item |
EKPO | MARA | MATNR | PO item to material master general data |
EKPO | MARC | MATNR, WERKS | PO item to plant data of the material |
EKKO (BSTYP K) | EKPO | EBELN | Contracts: header and items of outline agreements with document category K |
EBAN | EKPO | EBAN-BANFN = EKPO-BANFN, EBAN-BNFPO = EKPO-BNFPO | Purchase requisition item to the PO item that covers it |
EBAN | EBKN | BANFN, BNFPO | Requisition item to account assignment; EBKN holds the cost center |
MKPF | MSEG | MBLNR, MJAHR | Material document header to items in ECC |
MATDOC | MSEG / MKPF | MBLNR, MJAHR, ZEILE | S/4HANA material document table; MKPF and MSEG remain as compatibility views over MATDOC |
MSEG | EKPO | EBELN, EBELP | Goods movement line to the PO item it references |
MSEG | MARA | MATNR | Movement line to material master |
MSEG | CSKS | KOSTL, KOKRS | Goods issue to cost center (movement type 201 and similar) |
RBKP | RSEG | BELNR, GJAHR | Logistics invoice verification header to items (MIRO documents) |
RSEG | EKPO | EBELN, EBELP | Invoice item to the PO item invoiced |
RBKP | BKPF | AWTYP = RMRP, AWKEY = BELNR + GJAHR | Invoice document to its accounting document |
MARA | MAKT | MATNR, SPRAS | Material master general data to descriptions by language |
MARA | MARC | MATNR | General data to plant level data (MRP, procurement type) |
MARC | MARD | MATNR, WERKS | Plant data to storage location stock |
MARC | MBEW | MATNR = MATNR, WERKS = BWKEY | Plant to valuation data when valuation is at plant level |
MARA | MARM | MATNR | Material to alternative units of measure |
EINA | EINE | INFNR | Purchasing info record general data to purchasing organization data |
EINA | LFA1 | LIFNR | Info record to vendor |
LFA1 | LFM1 | LIFNR | Vendor general data to purchasing organization data |
CSKS | CSKT | KOKRS, KOSTL, DATBI | Cost center master to texts; pick the valid-to date row |
EKKN | CSKS | KOKRS, KOSTL | PO cost center link: read EKKN-KOSTL for the cost center on a PO item |
MMBE and MM03 are transaction codes, not tables: MMBE is the stock overview and MM03 displays a material master. The tables behind them are MARD, MARC and MARA. Key field lists are the usual ones; confirm the full primary key in SE11 for your release, and note that S/4HANA changes stock and material document tables (MATDOC, NSDM views).
Want these joins run for you?
Tell us the questions your buyers ask and we can show how a read-only assistant would answer them from your SAP data. Optional.
Optional. The tool and every export work without this. No spam.
How to read the map
Each row is one join: the table you start from, the table you reach, and the fields that connect them. Chain rows to build a query. For example, requisition to PO to goods movement to invoice runs through EBAN, EKPO, MSEG and RSEG. Always include the item field as well as the document number, or one PO with many items will multiply your rows.
- Chain EBAN, EKPO, MSEG and RSEG for the full procure-to-pay trail.
- Add the client field MANDT in every join when you work outside Open SQL.
- Use EKBE when you only need history, it avoids joining MSEG and RSEG.
What changed in S/4HANA
In S/4HANA the material document is stored in MATDOC, which merges the former header, item and stock figure tables. MKPF and MSEG still exist as compatibility views so old programs keep working, but a new report should select from MATDOC. Stock quantities by period and material are also read through views rather than the old summary tables. Check the simplification list for your target release before you freeze a data model.
Finding the cost center on a PO
The cost center is not in EKPO. It sits in the account assignment table EKKN, one row per PO item and account assignment line (EKKN-KOSTL with controlling area KOKRS). Requisitions work the same way through EBKN. For goods issues to a cost center, the cost center is carried on the material document line. Join EKKN to CSKS for master data and to CSKT for the name.
Common mistakes
Typical mistakes are joining on document number alone, forgetting that contracts and scheduling agreements share the EKKO and EKPO tables, and treating MMBE or MM03 as tables. Another is reading MBEW without matching the valuation area to the plant or company code, which returns the wrong price. Filter on BSTYP and deletion indicators before you count anything.
Frequently Asked Questions
What are the main SAP MM tables?
The core ones are EKKO and EKPO for purchasing documents, EBAN for requisitions, MARA, MARC and MARD for material master and stock, MKPF and MSEG (or MATDOC in S/4HANA) for goods movements, and RBKP and RSEG for invoice verification.
Is MMBE a table in SAP?
No. MMBE is a transaction code for the stock overview. The data behind it comes from tables such as MARD for storage location stock, MARC for plant data and MCHB for batch stock. Likewise MM03 is a transaction that displays a material master, not a table.
Which table stores the cost center on a purchase order?
EKKN, the PO account assignment table, holds the cost center in field KOSTL per item. Join EKKN to EKPO on EBELN and EBELP. For requisitions the equivalent table is EBKN. The cost center master data is in CSKS.
Where are contracts stored in SAP MM?
Outline agreements use the same tables as purchase orders. Contracts are EKKO and EKPO rows with document category K, and scheduling agreements use category L. Filter on BSTYP to separate them, and read EKAB for release documents against a contract.
If you keep rebuilding the same procure-to-pay joins by hand, we can wire a private assistant to a read-only copy of your SAP data so buyers ask in plain language and see the query it ran.
Related Tools
SAP MM Tables and Key Fields Reference
Searchable list of the core SAP MM tables with their primary key fields and what each stores, including S/4HANA changes.
SAPSAP MM Transaction Codes Reference
Searchable list of the SAP MM transaction codes consultants and buyers use daily, grouped by purchasing, inventory, invoice verification and MRP.
SAPSAP Open PO Items ABAP SELECT Generator
Fill in plant, document type and dates to generate ABAP Open SQL that lists open PO items with received quantity from EKBE.
SAPSAP BAPI_PO_CREATE1 ABAP Skeleton Generator
Fill in vendor, plant and material to generate an ABAP skeleton for creating a purchase order with BAPI_PO_CREATE1.
SAPSAP MM and QM BAPI and API List Reference
A searchable list of the common SAP MM and QM BAPIs and S/4HANA OData APIs, what each does, and whether it needs a commit.
More SAP tools
See all- SAP Sales Document Types Reference
- SAP Pricing Procedure Design Worksheet
- SAP Item Category Determination Reference
- SAP Delivery Block Reasons Template
- SAP Credit Management Checklist
- SAP Output Determination Checklist
- SAP Billing Types Reference
- SAP Incompletion Log Checklist
- SAP SD Tables Reference (VBAK, VBAP, LIKP, VBRK and More)
Keep exploring
Free tools
- SAP Manufacturing Order Table Join SQL GeneratorGenerates SQL that joins the SAP production order header, item and component tables with the correct keys, plus a field guide to each table.
- SAP Posting Keys ReferenceThe standard SAP posting keys with debit or credit side, account type and meaning, searchable in the browser.
- SAP QM Tables Relationship Map and Key JoinsA searchable relationship map of the main SAP QM tables with the key fields to join them, so you can build reports without guessing.
ERP fixes and how-tos
- Cost Center in SAP MM: Purchase Orders and Goods IssuesHow a cost center is used in SAP MM: account assignment category K on purchase orders, goods issues with movement type 201, and the account determination behind them.
- SAP MM Order Creation: ME21N Step by Step and the Procure-to-Pay ProcessStep-by-step ME21N purchase order creation in SAP MM, plus the procure-to-pay flow around it: requisition, goods receipt, invoice verification and payment.
- SAP MM Return to Vendor Process: Return PO, MIGO 161 and Credit MemoReturn goods to a vendor in SAP MM: return PO, MIGO movement 161 or 122, credit memo in MIRO, and how to handle scrap, rework and replacement shipments.