EKKO: Purchasing Document Header
MMEKKO is the header table of purchasing documents: purchase orders, contracts, scheduling agreements and requests for quotation. The document category BSTYP and the document type BSART tell them apart. Each row carries the company code, vendor, document date and purchasing group of the document.
Primary key
EBELN
plus the client field
Module
MM
Fields in this reference
8
How the EKKO key works
The primary key is MANDT plus EBELN, the 10-digit purchasing document number. Like other document numbers it is stored with leading zeros.
EKKO fields
| Field | Type / data element | Length | Description |
|---|---|---|---|
| πMANDT | CLNT | 3 | Client |
| πEBELN | EBELN | 10 | Purchasing Document Number |
| BUKRS | BUKRS | 4 | Company Code |
| BSTYP | BSTYP | 1 | Purchasing Document Category |
| BSART | BSART | 4 | Purchasing Document Type |
| LIFNR | LIFNR | 10 | Vendor Number |
| BEDAT | DATUM | 8 | Purchase Order Date |
| EKGRP | EKGRP | 3 | Purchasing Group |
This is a curated subset of the most commonly used fields, not the complete table definition. A real system contains more fields and can differ by release and customizing, so confirm the definition in transaction SE11 before relying on it.
Example ABAP SELECT for EKKO
" Open SQL applies the client (MANDT) automatically, so it is not part of the WHERE clause. DATA lv_ebeln TYPE ekko-ebeln. SELECT bukrs, bstyp, bsart FROM ekko WHERE ebeln = @lv_ebeln INTO TABLE @DATA(lt_ekko).
Modern Open SQL with host variables (ABAP 7.40 and later). Need a different field list or conditions? Build it in the ABAP SELECT Builder.
Tables related to EKKO
Practical tips for EKKO
- Filter on BSTYP = 'F' to restrict the result to purchase orders. Other values include K for contracts and L for scheduling agreements.
- Prices, quantities and plants are item data. EKKO only holds header-level values, so join EKPO when you need them.
- EKGRP is the purchasing group, often used to split documents between buying teams.
- Documents flagged for deletion carry a value in the deletion indicator LOEKZ at header level. Add LOEKZ = space to the WHERE clause unless you explicitly need deleted documents.
EKKO FAQ
How do I list only purchase orders from EKKO?
Add BSTYP = 'F' to the WHERE clause. Contracts have BSTYP K and scheduling agreements BSTYP L.
How do I join EKKO and EKPO?
On EBELN. EKKO holds one row per purchasing document and EKPO one row per item.
Keep exploring
- SAP Table Field Lookup: search all 28 tables and their fields.
- SAP BAPI Explorer: find the BAPI that creates or changes this data.
- CDS View Generator: expose these tables through a CDS view.
- Creating purchase orders with BAPI_PO_CREATE1