{"audience":"Purchasing teams, controlling teams that track budgets and commitments, MM teams responsible for year-end closing.","authorization_objects":[{"note":"Purchase order change authorization by document type","object":"M_BEST_BSA"},{"note":"Purchase order change authorization by purchasing organization","object":"M_BEST_EKO"},{"note":"Purchase order change authorization by plant","object":"M_BEST_WRK"}],"components":[],"countries":[],"effort_days_max":5,"effort_days_min":3,"effort_size":"M","faq":[{"a":"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.","q":"Can goods still be received on an item that was flagged?"},{"a":"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.","q":"How are project and cost center commitments affected?"},{"a":"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.","q":"Does the program work on S/4HANA?"}],"features":[{"code":"test_run","label":"Test mode (check without posting)","note":""},{"code":"log","label":"Line-by-line result and error log","note":""},{"code":"background","label":"Runs as a background job","note":""},{"code":"email","label":"Send the result by email","note":"Closed and skipped items can be sent to each purchasing group as a separate list."}],"functions":[{"name":"BAPI_PO_CHANGE","role":"Sets the delivery completed indicator on the order item"},{"name":"BAPI_TRANSACTION_COMMIT","role":"Saves the changes permanently per order"},{"name":"BAPI_TRANSACTION_ROLLBACK","role":"Rolls back changes in test mode or on error"}],"gap":"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.","id":"mm-po-auto-delivery-completed","industries":[],"input_columns":[],"kind":"program","language":"en","lastmod":"2026-11-17","logic":"1. 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.\n2. 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.\n3. 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.\n4. 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.\n5. 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.","module":"MM","object_type":"batch_job","output_columns":[{"calculated":false,"formula":"","label":"Purchase order","source_field":"EBELN","source_table":"EKPO"},{"calculated":false,"formula":"","label":"Item","source_field":"EBELP","source_table":"EKPO"},{"calculated":false,"formula":"","label":"Vendor","source_field":"LIFNR","source_table":"EKKO"},{"calculated":false,"formula":"","label":"Material","source_field":"MATNR","source_table":"EKPO"},{"calculated":false,"formula":"","label":"Plant","source_field":"WERKS","source_table":"EKPO"},{"calculated":false,"formula":"","label":"Order qty","source_field":"MENGE","source_table":"EKPO"},{"calculated":true,"formula":"Σ EKBE-MENGE (VGABE = 1, reversals negative)","label":"Received qty","source_field":null,"source_table":null},{"calculated":true,"formula":"EKPO-MENGE − received qty","label":"Remaining qty","source_field":null,"source_table":null},{"calculated":true,"formula":"Remaining qty × EKPO-NETPR ÷ EKPO-PEINH","label":"Remaining value","source_field":null,"source_table":null},{"calculated":false,"formula":"","label":"Latest delivery date","source_field":"EINDT","source_table":"EKET"},{"calculated":true,"formula":"Latest EKBE-BUDAT (VGABE = 1)","label":"Last goods receipt","source_field":null,"source_table":null},{"calculated":true,"formula":"The rule that made the item a candidate and its value","label":"Rule","source_field":null,"source_table":null},{"calculated":true,"formula":"Completed, skipped or error","label":"Status","source_field":null,"source_table":null},{"calculated":true,"formula":"Skip reason or BAPI return message","label":"Message","source_field":null,"source_table":null}],"parameters":[{"example":"1000","kind":"select_option","label":"Company code","name":"S_BUKRS","ref_field":"EKKO-BUKRS","required":true},{"example":"1000","kind":"select_option","label":"Purchasing organization","name":"S_EKORG","ref_field":"EKKO-EKORG","required":false},{"example":"NB","kind":"select_option","label":"Order document type","name":"S_BSART","ref_field":"EKKO-BSART","required":false},{"example":"1100","kind":"select_option","label":"Plant","name":"S_WERKS","ref_field":"EKPO-WERKS","required":false},{"example":"X","kind":"checkbox","label":"Rule 1: remaining quantity below tolerance","name":"P_RULE1","ref_field":"","required":false},{"example":"5","kind":"parameter","label":"Remaining quantity tolerance (%)","name":"P_TOLPCT","ref_field":"","required":false},{"example":"X","kind":"checkbox","label":"Rule 2: delivery date and last receipt are old","name":"P_RULE2","ref_field":"","required":false},{"example":"90","kind":"parameter","label":"Days after the delivery date","name":"P_DAYS","ref_field":"","required":false},{"example":"X","kind":"checkbox","label":"Test mode (list without changing)","name":"P_TEST","ref_field":"","required":false}],"part_of":[],"performance":"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.","process":"P2P","quote_url":"https://nekuhub.com/en/request-a-quote/?report=mm-po-auto-delivery-completed","related":["co-cost-center-plan-actual-commitment","mm-open-po-by-vendor","ps-wbs-budget-actual-commitment"],"releases":[],"source":"custom","standard_alternatives":[{"note":"Sets the delivery completed flag by hand on one order item.","tcode":"ME22N"},{"note":"Lists open items; cannot apply rules or set the flag.","tcode":"ME2N"}],"summary":"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.","tables":[{"access":"read","join_on":"","role":"Order header: company code, purchasing organization, document type, vendor (driving table)","table":"EKKO","variant":"both"},{"access":"write","join_on":"EKPO-EBELN = EKKO-EBELN","role":"Order item: quantity and the delivery completed flag (ELIKZ) is updated","table":"EKPO","variant":"both"},{"access":"read","join_on":"EKET-EBELN = EKPO-EBELN AND EKET-EBELP = EKPO-EBELP","role":"Schedule line: latest delivery date","table":"EKET","variant":"both"},{"access":"read","join_on":"EKBE-EBELN = EKPO-EBELN AND EKBE-EBELP = EKPO-EBELP","role":"Order history: received and invoiced quantity, last receipt date","table":"EKBE","variant":"both"}],"title":"Automatic Delivery Completed Flag for Old Open Purchase Order Items Program","url":"https://nekuhub.com/en/programs/automatic-delivery-completed-flag-for-old-open-purchase-order-items-program/","vendor_id":"nekudos"}