# Orders Using Expired or Locked Production Versions Report

> A custom ALV report that checks production versions against their validity dates, lock status and the validity of the BOM and routing they point to, and lists the open production and planned orders created with that version. Versions that will expire soon are flagged in advance.

- Type: Report, Custom development, ALV report
- Module: PP
- Estimated effort: M (3–5 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/reports/production-orders-with-expired-or-locked-production-version-report/


## Why is the standard not enough?

C223 is used to maintain production versions and run the consistency check; it does not show open orders that were created with a version before it expired or was locked. Even when the linked BOM alternative was deleted or the routing carries a deletion flag, each version has to be opened separately to see it. As a result orders fail when they are re-read, MRP cannot create new planned orders or the cost estimate stops. The custom report gives the problem versions and the orders they affect in one list.

### Closest standard alternatives

- C223: Maintains and checks production versions; does not list open orders created with the version.
- COOIS: Can list orders with their production version, but does not check whether the version is still valid.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| MKAL | Production version: validity, lock, BOM and routing link (driving table) | Read | - | ECC + S/4 |
| MAST | Existence of the version's BOM usage and alternative | Read | MAST-MATNR = MKAL-MATNR AND MAST-WERKS = MKAL-WERKS AND MAST-STLAN = MKAL-STLAN AND MAST-STLAL = MKAL-STLAL | ECC + S/4 |
| STKO | BOM header validity and deletion indicator | Read | STKO-STLTY = 'M' AND STKO-STLNR = MAST-STLNR AND STKO-STLAL = MAST-STLAL | ECC + S/4 |
| PLKO | Routing header validity and deletion flag | Read | PLKO-PLNTY = MKAL-PLNTY AND PLKO-PLNNR = MKAL-PLNNR AND PLKO-PLNAL = MKAL-ALNAL | ECC + S/4 |
| AFPO | Open production order items created with this version | Read | AFPO-MATNR = MKAL-MATNR AND AFPO-DWERK = MKAL-WERKS AND AFPO-VERID = MKAL-VERID | ECC + S/4 |
| AFKO | Scheduled start of the production order | Read | AFKO-AUFNR = AFPO-AUFNR | ECC + S/4 |
| PLAF | Open planned orders created with this version | Read | PLAF-MATNR = MKAL-MATNR AND PLAF-PLWRK = MKAL-WERKS AND PLAF-VERID = MKAL-VERID | ECC + S/4 |
| MAKT | Material description | Read | MAKT-MATNR = MKAL-MATNR AND MAKT-SPRAS = SY-LANGU | ECC + S/4 |

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_WERKS | Plant | Range / multiple | MKAL-WERKS | Yes |
| S_MATNR | Material | Range / multiple | MKAL-MATNR | No |
| S_DISPO | MRP controller | Range / multiple | MARC-DISPO | No |
| P_KEYDT | Key date | Single value | - | Yes |
| P_HORIZ | Expiry warning horizon (days) | Single value | - | No |
| P_OPEN | Only versions with open orders | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| Material | MKAL-MATNR |
| Description | MAKT-MAKTX |
| Plant | MKAL-WERKS |
| Production version | MKAL-VERID |
| Version text | MKAL-TEXT1 |
| Valid from | MKAL-ADATU |
| Valid to | MKAL-BDATU |
| Lock | MKAL-MKSP |
| BOM alternative | MKAL-STLAL |
| Routing group | MKAL-PLNNR |
| Check status | MKAL-PRFG_F |
| Issue found | Calculated: Expired, expiring soon, locked, BOM invalid or routing invalid |
| Open production orders | Calculated: Number of AFPO items with the same MATNR, DWERK and VERID, ELIKZ blank and no TECO |
| Open planned orders | Calculated: Number of PLAF records with the same MATNR, PLWRK and VERID |
| Earliest start | Calculated: MIN(AFKO-GSTRP, PLAF-PSTTR) |

## How does the report work?

1. Production versions are read from MKAL for the plant and materials on the selection screen.
2. Every version is checked: is the validity end (BDATU) before the key date; does it fall within the selected warning horizon; is the lock indicator (MKSP) set; does the consistency check status (PRFG_F) show an error.
3. The BOM usage and alternative of the version (STLAN, STLAL) are looked up in MAST and STKO; when not found, flagged for deletion (STKO-LOEKZ) or not valid on the key date, it is marked as an issue.
4. The routing of the version (PLNTY, PLNNR, ALNAL) is looked up in PLKO; a deletion flag (LOEKZ) or a validity start (DATUV) after the key date is written as an issue.
5. For problem versions, open production orders created with the same material, plant and VERID (AFPO, ELIKZ blank, no TECO) and open planned orders (PLAF) are counted; the earliest order start comes from AFKO-GSTRP and PLAF-PSTTR.
6. When 'only with open orders' is selected, versions without open orders are hidden.

## Authorization objects

- C_AFKO_AWK: Display open production orders by plant and order type
- C_STUE_WRK: Display the linked BOMs by plant
- C_ROUT: Display the linked routings

## Frequently asked questions

### Does the report fix production versions?

No, the report only reads. Corrections are made in C223 or with a separate mass update program; the version number in the report leads directly to C223.

### Are repetitive manufacturing and process orders included?

Production versions are used in all of these scenarios. The base version counts production and planned orders; process orders (PP-PI) use the same AFPO structure and can be included by order type selection.

### Why does this matter more on S/4HANA?

In S/4HANA the production version is mandatory for MRP and order creation, so an invalid version stops planning directly. The report works on S/4HANA with the same tables.

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