SAP Open Purchase Order Items ABAP Report Generator
Standard transaction ME2N and ME2M list open purchase orders, but teams often need a custom report with specific filters or an output for a downstream tool. This generator builds an ABAP report that joins the three core purchasing tables and calculates open quantity per schedule line.
Fill in
NB = standard PO, FO = framework order, UB = stock transport order
REPORT ZMM_OPEN_PO_ITEMS.
* Open PO schedule lines: not deleted, delivery not completed,
* scheduled on or before the entered date.
SELECT k~ebeln,
p~ebelp,
k~lifnr,
k~bsart,
p~matnr,
p~werks,
p~meins,
e~eindt,
e~menge AS sched_qty,
e~wemng AS received_qty
FROM ekko AS k
INNER JOIN ekpo AS p ON p~ebeln = k~ebeln
INNER JOIN eket AS e ON e~ebeln = p~ebeln
AND e~ebelp = p~ebelp
WHERE k~ekorg = '1000'
AND k~bsart = 'NB'
AND k~loekz = @space
AND p~werks = '1000'
AND p~loekz = @space
AND p~elikz = @space
AND e~eindt <= '20261130'
ORDER BY e~eindt, k~ebeln, p~ebelp
INTO TABLE @DATA(lt_items).
IF sy-subrc <> 0.
WRITE: / 'No open items found'.
RETURN.
ENDIF.
LOOP AT lt_items INTO DATA(ls_item).
DATA(lv_open) = ls_item-sched_qty - ls_item-received_qty.
IF lv_open <= 0.
CONTINUE.
ENDIF.
WRITE: / ls_item-ebeln, ls_item-ebelp, ls_item-lifnr,
ls_item-matnr, ls_item-eindt, lv_open, ls_item-meins.
ENDLOOP.Open quantity is scheduled quantity (EKET-MENGE) minus received quantity (EKET-WEMNG). The delivery completed indicator is EKPO-ELIKZ and the deletion indicator is LOEKZ. Requires ABAP 7.40 or higher for inline declarations. Test in a development system, and add authority checks on purchasing organisation (M_BEST_EKO) and plant (M_BEST_WRK) before productive use. For large systems, add a WHERE clause on document date to limit volume.
Custom SAP report help
Optional: tell us the report you need and we can reply with a reviewed query or a read-only natural language view over your SAP data.
Optional. The tool and every export work without this. No spam.
How to use the generator
Fill in the purchasing organisation, plant, document type and the latest delivery date you care about, then give your report a Z name. Copy the generated code into SE38 or an ABAP development tool in Eclipse, activate it and run it. It lists each open schedule line with vendor, material, delivery date and open quantity. Adjust the output section to use a class such as the ALV grid if you need sorting, filtering and export from the report itself.
- Use a development system first
- Add select options for broader filters
- Keep the select list short for performance
How the tables relate
EKKO holds the purchasing document header with the vendor, purchasing organisation and document type. EKPO holds items with material, plant, unit of measure and indicators for deletion and delivery completed. EKET holds the schedule lines, with scheduled quantity, delivery date and the quantity already received. A purchase order item can have several schedule lines, so open quantity should be calculated per schedule line, not per item. Joining on document and item keeps the three consistent.
Making it production ready
Replace hard-coded values with a selection screen using SELECT-OPTIONS or PARAMETERS, add authority checks for the purchasing organisation and plant, and consider limiting by document date to avoid reading years of history. On large systems add an index-friendly filter, and for very high volume consider a CDS view or standard purchase order analytical views rather than custom joins. Check whether your release exposes released CDS views for purchasing documents, which are preferable in S/4HANA extension scenarios.
Common mistakes
Forgetting the deletion and delivery completed indicators produces closed or cancelled items in the list. Treating item quantity as open quantity misses partial deliveries. Skipping unit of measure conversion can mislead when order units differ from base units. Note also that subcontracting and scheduling agreement items follow different logic in the tables.
- Filter LOEKZ and ELIKZ
- Use EKET for open quantity
- Check order unit versus base unit
Frequently Asked Questions
Which tables hold purchase order data?
EKKO is the header, EKPO the item, EKET the schedule lines, and EKBE the document history of goods receipts and invoices. Conditions are in the KONV table in older releases and in PRCD_ELEMENTS in S/4HANA.
How do I find open quantity on a PO?
Subtract the received quantity from the scheduled quantity for each schedule line in EKET (MENGE minus WEMNG). Alternatively compare item quantity with the sum of goods receipts in EKBE, which is slower.
What does ELIKZ mean?
It is the delivery completed indicator on the PO item. When set, the item is treated as fully delivered, even if the quantity is under-delivered, and MRP no longer plans the open quantity.
Can I use this code unchanged?
Treat it as a starting point. Field names are standard, but you should adjust it for your release, add authority checks, and test performance on production-sized data before scheduling it.
Netray can answer open order questions in plain language over your SAP data, showing the query it ran, read-only and respecting your authorisations.
Related Tools
SAP Invoice Verification Tolerance Calculator
Simulates the price and quantity variance checks behind MIRO invoice blocks so you can test tolerance limits before changing OMR6.
SAPSAP MRP Rounding Value and Lot Size Order Quantity Calculator
Predicts the quantity MRP will propose after assembly scrap, minimum lot size, rounding value and maximum lot size, and shows the excess it creates.
SAPSAP Material Valuation and Price Unit Worksheet
A fill-in worksheet that recomputes inventory value per material from quantity, price and price unit, so you can reconcile with MBEW or migration loads.
SAPSAP MRP Reorder Point and Safety Stock Calculator
Works out the reorder point and safety stock to maintain for reorder point planning in SAP, using planned delivery time, GR processing time and a target service level.