# Automatic Technical Completion (TECO) of Production Orders Program

> A custom background program that finds production orders that are fully delivered, have no open reservations or COGI records left and whose last goods receipt is older than a grace period, and technically completes them automatically. Orders that fail a check are listed with the reason.

- Type: Program, Custom development, Background program
- Module: PP
- Estimated effort: M (3–5 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/automatic-production-order-technical-completion-program/


## Why is the standard not enough?

COHV can set TECO in bulk but only looks at the selection criteria; it does not check the delivery tolerance, open reservations, movements pending in COGI or the time since the last goods receipt. Unchecked TECO hides open reservations and failed movements; without TECO, hundreds of old orders stay open, inflate month-end WIP and variance runs and leave wrong requirements in MRP.

### Closest standard alternatives

- COHV: Sets TECO in bulk; no delivery tolerance, open reservation or COGI check.
- CO02: Sets TECO on one order; not practical for hundreds of old orders.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| AUFK | Order type, plant and object number | Read | - | ECC + S/4 |
| AFKO | MRP controller and basic finish date | Read | - | ECC + S/4 |
| AFPO | Order quantity, quantity received and last goods receipt date | Read | - | ECC + S/4 |
| RESB | Open component reservation check | Read | - | ECC + S/4 |
| AFFW | Check for failed movements pending in COGI | Read | - | ECC + S/4 |
| JEST | System status; TECO is set through the BAPI | Write | - | ECC + S/4 |

## BAPIs and functions used

- BAPI_PRODORD_COMPLETE_TECH: Technically completes the orders that pass the checks
- BAPI_TRANSACTION_COMMIT: Saves the status change permanently

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_WERKS | Plant | Range / multiple | AUFK-WERKS | Yes |
| S_AUART | Order type | Range / multiple | AUFK-AUART | No |
| S_DISPO | MRP controller | Range / multiple | AFKO-DISPO | No |
| S_GLTRP | Basic finish date | Range / multiple | AFKO-GLTRP | No |
| P_GRACE | Grace period after last goods receipt (days) | Single value | - | Yes |
| P_TOLPCT | Under-delivery tolerance (%) | Single value | - | No |
| P_TEST | Test mode (candidate list only) | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Production order | AFKO-AUFNR |
| Material | AFPO-MATNR |
| Order qty | AFPO-PSMNG |
| Received qty | AFPO-WEMNG |
| Delivered % | Calculated: AFPO-WEMNG ÷ AFPO-PSMNG × 100 |
| Open reservations | Calculated: Number of RESB items with BDMNG − ENMNG > 0 and KZEAR blank |
| COGI records | Calculated: Number of AFFW rows of the order |
| Last goods receipt | AFPO-LTRMI |
| Result | Calculated: Technically completed, candidate (test) or skipped |
| Message | Calculated: Reason for skipping or BAPI return message |

## How does the program work?

1. Production orders in the selection are read from AUFK and AFKO; orders with REL (I0002) active and TECO (I0045), CLSD (I0046) and the deletion flag (I0076) inactive in JEST become candidates.
2. Delivery check: AFPO-WEMNG ≥ AFPO-PSMNG × (1 − tolerance ÷ 100), or the delivery completed flag (AFPO-ELIKZ) is set. The last goods receipt date (AFPO-LTRMI) must be older than the grace period.
3. Open reservation check: if RESB has an item of the order that is not deleted (XLOEK blank), has no final issue (KZEAR blank) and BDMNG − ENMNG > 0, the order is skipped.
4. COGI check: if AFFW has records for the order, it is skipped; otherwise the failed movement becomes hard to follow after TECO.
5. For orders that pass all checks BAPI_PRODORD_COMPLETE_TECH is called and saved with BAPI_TRANSACTION_COMMIT; in test mode the BAPI is not called and only the candidate list is produced. Reservations and capacity requirements are closed as standard and TECO becomes active in JEST.
6. The result is written to the application log and a summary is emailed to planning.

## Authorization objects

- C_AFKO_AWK: Authorization to change orders (TECO) by plant and order type
- C_AFKO_AWA: Production order authorization by order type

## Frequently asked questions

### Can TECO be reversed?

Yes. Technical completion can be reversed as standard (revoke TECO in CO02). The program logs the orders it completes in every run, so it is always clear which order was completed when.

### Does the program close (CLSD) the orders?

No. The program only sets TECO. Closing should follow variance calculation and settlement; if needed, it can be added as a separate step with BAPI_PRODORD_CLOSE.

### Can it be used on S/4HANA?

Yes. BAPI_PRODORD_COMPLETE_TECH and the tables it reads work the same way on S/4HANA.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=pp-auto-teco-production-orders
