βš™οΈSAPTools

EKKO: Purchasing Document Header

MM

EKKO 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

FieldType / data elementLengthDescription
πŸ”‘MANDTCLNT3Client
πŸ”‘EBELNEBELN10Purchasing Document Number
BUKRSBUKRS4Company Code
BSTYPBSTYP1Purchasing Document Category
BSARTBSART4Purchasing Document Type
LIFNRLIFNR10Vendor Number
BEDATDATUM8Purchase Order Date
EKGRPEKGRP3Purchasing 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

  • EKPO (joined on EBELN): Items of the purchasing document.
  • LFA1 (joined on LIFNR): Vendor master data.
  • EKBE (joined on EBELN + EBELP): Purchase order history: goods receipts and invoice receipts.
  • EKKN (joined on EBELN + EBELP): Account assignment of the items.

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