Automatic Delivery Completed Flag for Old Open Purchase Order Items Program
Short answer: A custom background program that selects purchase order items by rule, those whose remaining quantity is below a tolerance or whose delivery date passed long ago with no goods receipt expected, and sets them to delivery completed. This cleans up open order lists and removes unnecessary order commitments on cost centers or projects.
- Estimated effort
- M · 3–5 working days
- System
- ECC and S/4HANA
- Tables
- 4
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
The delivery completed flag is set by hand in ME22N item by item. Mass maintenance (MASS / MEMASSPO) needs the records to be selected by hand and does not apply business rules such as the remaining quantity percentage, days since the last goods receipt or invoices waiting. Items partially received years ago therefore keep showing as open in ME2N and remain as commitments in CJI5 or KSB1.
Who uses it? Purchasing teams, controlling teams that track budgets and commitments, MM teams responsible for year-end closing.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| EKKOPurchasing Document Header | Order header: company code, purchasing organization, document type, vendor (driving table) | Read | ECC + S/4 |
| EKPOPurchasing Document Item | Order item: quantity and the delivery completed flag (ELIKZ) is updated | Write | ECC + S/4 |
| EKETPurchasing Schedule Lines | Schedule line: latest delivery date | Read | ECC + S/4 |
| EKBEPurchasing Document History | Order history: received and invoiced quantity, last receipt date | Read | ECC + S/4 |
BAPIs and functions used
- BAPI_PO_CHANGEChange Purchase Order. Sets the delivery completed indicator on the order item
- BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves the changes permanently per order
- BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back changes in test mode or on error
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| S_BUKRS | Company code | Range / multiple | EKKO-BUKRS | Yes | 1000 |
| S_EKORG | Purchasing organization | Range / multiple | EKKO-EKORG | No | 1000 |
| S_BSART | Order document type | Range / multiple | EKKO-BSART | No | NB |
| S_WERKS | Plant | Range / multiple | EKPO-WERKS | No | 1100 |
| P_RULE1 | Rule 1: remaining quantity below tolerance | Checkbox | — | No | X |
| P_TOLPCT | Remaining quantity tolerance (%) | Single value | — | No | 5 |
| P_RULE2 | Rule 2: delivery date and last receipt are old | Checkbox | — | No | X |
| P_DAYS | Days after the delivery date | Single value | — | No | 90 |
| P_TEST | Test mode (list without changing) | Checkbox | — | No | X |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Purchase order | EKPO-EBELN |
| 2 | Item | EKPO-EBELP |
| 3 | Vendor | EKKO-LIFNR |
| 4 | Material | EKPO-MATNR |
| 5 | Plant | EKPO-WERKS |
| 6 | Order qty | EKPO-MENGE |
| 7 | Received qty | Calculated Σ EKBE-MENGE (VGABE = 1, reversals negative) |
| 8 | Remaining qty | Calculated EKPO-MENGE − received qty |
| 9 | Remaining value | Calculated Remaining qty × EKPO-NETPR ÷ EKPO-PEINH |
| 10 | Latest delivery date | EKET-EINDT |
| 11 | Last goods receipt | Calculated Latest EKBE-BUDAT (VGABE = 1) |
| 12 | Rule | Calculated The rule that made the item a candidate and its value |
| 13 | Status | Calculated Completed, skipped or error |
| 14 | Message | Calculated Skip reason or BAPI return message |
Sample result list
| Purchase order | Item | Vendor | Material | Plant | Order qty | Received qty | Remaining qty | Remaining value | Latest delivery date | Last goods receipt | Rule | Status | Message |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4500012488 | 00010 | 100245 | PK-1180 | 1100 | 10,000 | 9,700 | 300 | 555 | 06/30/2026 | 07/02/2026 | Remaining 3% ≤ 5% | Completed | Delivery completed flag set |
| 4500012301 | 00030 | 100387 | RM-2040 | 1100 | 2,000 | 1,200 | 800 | 48,960 | 05/15/2026 | 05/20/2026 | 186 days past the delivery date | Completed | Delivery completed flag set |
| 4500012415 | 00020 | 100512 | CH-0315 | 1200 | 400 | 0 | 400 | 3,640 | 07/31/2026 | 109 days past the delivery date | Skipped | An invoice is waiting for the item |
How does the program work?
- EKKO and EKPO are read by company code, purchasing organization, document type and plant; items whose delivery completed (ELIKZ) and deletion (LOEKZ) flags are blank and that expect a goods receipt remain.
- Net goods receipts (VGABE = 1) and invoiced quantity (VGABE = 2) are summed from EKBE and the last receipt date is found; the latest delivery date (EINDT) comes from EKET.
- Rule 1: remaining quantity ÷ order quantity × 100 ≤ tolerance percentage. Rule 2: the latest delivery date and the last goods receipt are older than P_DAYS days. If either rule is met, the item becomes a candidate.
- Exceptions: if the invoiced quantity is above the received quantity (invoice waiting), or an open inbound delivery or shipping notification exists, the item is skipped and the reason is written to the list.
- Candidates are changed per order with BAPI_PO_CHANGE using POITEM-NO_MORE_GR = X and the POITEMX flag; in test mode the BAPI runs with its test flag and BAPI_TRANSACTION_ROLLBACK follows. In a real run BAPI_TRANSACTION_COMMIT is done per order, and the result list can be emailed to the purchasing groups.
Performance notes
The first run can find thousands of old items; split it by purchasing group and run it in the background. Later monthly runs take a few minutes. Because BAPI_PO_CHANGE is called per order, locked orders fail and are retried in the next run.
Features
- Test mode (check without posting)
- Line-by-line result and error log
- Runs as a background job
- Send the result by email Closed and skipped items can be sent to each purchasing group as a separate list.
Authorization objects
- M_BEST_BSAPurchase order change authorization by document type
- M_BEST_EKOPurchase order change authorization by purchasing organization
- M_BEST_WRKPurchase order change authorization by plant
Frequently asked questions
Can goods still be received on an item that was flagged?
Yes. The delivery completed flag does not block goods receipts; it only removes the item from open lists and commitments. If needed, the flag can be removed in ME22N.
How are project and cost center commitments affected?
The order commitment for the remaining quantity is reduced when the flag is set. The program is therefore also used to clean up inflated commitments in project and budget reports.
Does the program work on S/4HANA?
Yes. BAPI_PO_CHANGE and the order tables are the same in S/4HANA. Standard order closing apps in S/4HANA can also be used; this program adds company-specific rules and exceptions.
Related reports
Cost Center Plan vs Actual with Commitments Report
A custom ALV report that shows plan, actual and open purchasing commitments per cost center and cost element on one row, and calculates the remaining …
Open Purchase Orders by Vendor Report
A custom ALV report that shows, per vendor, the quantity not yet received, the open order value and the days of delay since the delivery date in a …
WBS Budget vs Actual vs Commitment Report with Remaining Budget
A custom report that shows, for each WBS element, the current budget, plan, actual cost, requisition and order commitments, remaining budget and …
Let us build this program for your system
Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.