# Mass Maintenance Order Creation from Open Notifications Program

> A custom program that groups open maintenance notifications without an order by equipment or functional location and creates one maintenance order per group, linking the first notification to the order header and the others to the object list. It creates one operation per notification, optionally releases the order and lists the result per group.

- Type: Program, Custom development, Background program
- Module: PM
- Estimated effort: M (5–7 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/mass-maintenance-order-creation-from-notifications-program/


## Why is the standard not enough?

Through IW22 or IW28 a separate order is created for each notification; in IW31 several notifications can be added to the object list by hand, but there is no mass, rule-based way to do it. Five small notifications created during a day for the same machine turn into five separate orders; planning, cost tracking and technician dispatch get scattered. The custom program groups the notifications by rule and creates one order through a BAPI.

### Closest standard alternatives

- IW28: Lists notifications and converts them to orders one by one; there is no rule-based grouping.
- IW31: Several notifications can be added to the object list by hand; there is no mass processing.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| QMEL | Notification header: type, short text, priority; the order link is written by the BAPI | Read / write | - | ECC + S/4 |
| QMIH | Equipment, planning plant, planner group, location | Read | QMIH-QMNUM = QMEL-QMNUM | ECC + S/4 |
| ILOA | Functional location of the notification (grouping key) | Read | ILOA-ILOAN = QMIH-ILOAN | ECC + S/4 |
| AUFK | New maintenance order header | Write | AUFK-AUFNR = yeni sipariş | ECC + S/4 |
| AFIH | Maintenance order data: equipment, planning plant, priority | Write | AFIH-AUFNR = AUFK-AUFNR | ECC + S/4 |
| AFVC | Operations created per notification | Write | AFVC-AUFPL = AFKO-AUFPL | ECC + S/4 |

## BAPIs and functions used

- BAPI_ALM_ORDER_MAINTAIN: Creates the maintenance order with header, operations and object list, and releases it when requested
- BAPI_ALM_NOTIF_GET_DETAIL: Reads the current status and order link of the notification before processing
- BAPI_TRANSACTION_COMMIT: Saves successful groups permanently
- BAPI_TRANSACTION_ROLLBACK: Rolls back in test mode and for failed groups

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_IWERK | Planning plant | Range / multiple | QMIH-IWERK | Yes |
| S_QMART | Notification type | Range / multiple | QMEL-QMART | Yes |
| S_INGRP | Planner group | Range / multiple | QMIH-INGRP | No |
| S_PRIOK | Priority | Range / multiple | QMEL-PRIOK | No |
| S_QMDAT | Notification date | Range / multiple | QMEL-QMDAT | No |
| P_AUART | Order type to create | Single value | AUFK-AUART | Yes |
| R_EQUI | Group by equipment | Radio button | - | No |
| R_FLOC | Group by functional location | Radio button | - | No |
| P_REL | Release the orders | Checkbox | - | No |
| P_TEST | Test mode (grouping preview only) | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Group | Calculated: Equipment or functional location + planner group |
| Equipment | QMIH-EQUNR |
| Functional location | ILOA-TPLNR |
| Notifications | Calculated: Number of QMEL records in the group |
| Notification numbers | Calculated: QMEL-QMNUM values in the group |
| Highest priority | QMEL-PRIOK |
| Order | AUFK-AUFNR |
| Operations | Calculated: Number of AFVC lines created |
| Status | Calculated: Created, released, test passed or error |
| Message | Calculated: BAPI return message |

## How does the program work?

1. Open, not completed notifications without an order (QMEL-AUFNR blank) of the selected notification type, planning plant, planner group, priority and notification date are read from QMEL and QMIH.
2. The functional location of the notification is found through QMIH-ILOAN with ILOA-TPLNR; the grouping key is equipment (QMIH-EQUNR) or functional location, as selected, with planner group and main work center added to the key.
3. For each group BAPI_ALM_ORDER_MAINTAIN is called: HEADER CREATE with order type, planning plant, the object of the first notification and the highest priority; OPERATION CREATE per notification with the notification short text and main work center; OBJECTLIST CREATE links the other notifications to the order.
4. With 'release' selected, the RELEASE method is added in the same call; in test mode the call is rolled back with BAPI_TRANSACTION_ROLLBACK, in a real run each group is committed.
5. Notifications that are locked or have meanwhile been linked to an order by another user are skipped with an error message; the other groups continue.
6. The result list shows the group, its notifications, the new order number, number of operations and the BAPI message.

## Authorization objects

- I_QMEL: Change maintenance notifications by notification type
- I_AUART: Create maintenance orders by order type
- I_IWERK: Authorization by planning plant

## Frequently asked questions

### Can a task list be added to the order automatically?

Yes. If a general or equipment task list is assigned, the operations can come from the task list instead of the notification text; adding this option increases the effort range by one day.

### Are breakdown notifications (priority 1) grouped too?

This is not recommended. Urgent breakdowns are usually handled immediately with a separate order, so priority 1 is excluded in the default selection; it can be added on the selection screen if needed.

### Does the program work on S/4HANA?

Yes. BAPI_ALM_ORDER_MAINTAIN is supported on S/4HANA. For a clean core approach, the same logic can also be built on the released maintenance order APIs.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=pm-orders-from-open-notifications
