Mass Component Add, Delete and Change in Open Production Orders
Short answer: A program that adds, deletes and changes components in many open production orders in one go from an Excel file after an engineering or project change: quantity, storage location and project (WBS) assignment. Every line is checked in a test run first; results and error lines are returned as a file.
- Estimated effort
- M · 6–10 working days
- System
- ECC and S/4HANA
- Tables
- 7
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
When a BOM changes, existing open orders are not updated automatically; either the order is re-read from master data (which wipes all manual changes) or each order is opened in CO02 and its components edited one by one. CS20 changes BOMs in bulk, not orders. The custom program changes only the components named in the file without re-reading the order.
Who uses it? Production planners, product engineering and project planners in project-based manufacturing.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| RESBReservation/Dependent Requirements | Order components: added, deleted and changed items | Read / write | ECC + S/4 |
| AFKOOrder Header Data for PP Orders | Order header and reservation number | Read | ECC + S/4 |
| AFPOOrder Item | Order item: material and plant | Read | ECC + S/4 |
| AFVCOperation within an Order | Operation the component is assigned to | Read | ECC + S/4 |
| JESTIndividual Object Status | Order status: technically completed, closed, deletion flag | Read | ECC + S/4 |
| MARCPlant Data for Material | Plant data of the component material | Read | ECC + S/4 |
| PRPSWBS Element Master Data | WBS element check for project assignment | Read | ECC + S/4 |
BAPIs and functions used
- CO_XT_COMPONENT_ADDAdd Component to Production Order. Adds a new component to the order
- CO_XT_COMPONENT_CHANGEChange Production Order Component. Changes component quantity, storage location, operation or WBS assignment
- STATUS_READRead Object Status. Checks the order status
- BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves the changes per order
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| P_FILE | Upload file (Excel) | Single value | — | Yes | C:\temp\bilesen_degisiklik.xlsx |
| P_WERKS | Plant | Single value | AFPO-DWERK | Yes | 1000 |
| P_TEST | Test run | Checkbox | — | No | X |
| P_REL | Also change released orders | Checkbox | — | No | X |
Input file columns
The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.
| # | Column | Target field | Required |
|---|---|---|---|
| 1 | Order | RESB-AUFNR | No |
| 2 | Action (A/D/C) | By rule A = add, D = delete, C = change; R for a rule line | No |
| 3 | Operation | RESB-VORNR | No |
| 4 | Item no. | RESB-POSNR | No |
| 5 | Material | RESB-MATNR | No |
| 6 | Quantity | RESB-BDMNG | No |
| 7 | Unit | RESB-MEINS | No |
| 8 | Storage location | RESB-LGORT | No |
| 9 | WBS element | PRPS-POSID | No |
Sample upload file
| 1 | Order | Action (A/D/C) | Operation | Item no. | Material | Quantity | Unit | Storage location | WBS element |
|---|---|---|---|---|---|---|---|---|---|
| 2 | 1004512 | C | 0010 | 0020 | HM-20455 | 6 | AD | D100 | |
| 3 | 1004512 | A | 0010 | HM-20460 | 2 | AD | D100 | ||
| 4 | 1004530 | D | 0020 | 0040 | HM-11870 | ||||
| 5 | 1004547 | C | 0010 | 0010 | HM-30017 | P-26-014.02.03 |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Order | RESB-AUFNR |
| 2 | Action | Calculated Add, delete or change |
| 3 | Material | RESB-MATNR |
| 4 | Old value | Calculated Quantity, storage location or WBS before the change |
| 5 | New value | Calculated Value from the file |
| 6 | Status | Calculated Success, test OK, warning or error |
| 7 | Message | Calculated Function return message or check message |
Sample result list
| Order | Action | Material | Old value | New value | Status | Message |
|---|---|---|---|---|---|---|
| 1004512 | Change | HM-20455 | 4 AD | 6 AD | Success | Component quantity updated |
| 1004512 | Add | HM-20460 | 2 AD | Success | Added as item 0050 | |
| 1004530 | Delete | HM-11870 | 10 AD | Warning | 4 PC already withdrawn for the component; not deleted | |
| 1004547 | Change | HM-30017 | P-26-014.02.01 | P-26-014.02.03 | Success | WBS assignment changed |
How does the program work?
- Each file line holds one action: order, action type (A = add, D = delete, C = change), operation, item number, material, quantity, unit, storage location and an optional WBS element. Rule lines like ‘replace X with Y in all open orders’ are also supported; the program then finds the open orders containing the component in RESB and generates the lines itself.
- Checks: does the order exist in AFKO/AFPO and is its status (JEST, STATUS_READ) technically completed, closed or flagged for deletion; does the operation exist in AFVC; is the material defined in the plant (MARC); is the WBS element valid in PRPS; has the component to be deleted or changed already been withdrawn (RESB-ENMNG). A withdrawn component is not deleted; the line is skipped with a warning.
- Adding uses CO_XT_COMPONENT_ADD, changing (quantity, storage location, project assignment I_PSPEL, operation assignment) uses CO_XT_COMPONENT_CHANGE and deleting uses CO_XT_COMPONENTS_DELETE, all in the order buffer. After all lines of an order are processed, CO_XT_ORDER_PREPARE_COMMIT and BAPI_TRANSACTION_COMMIT are called; if one line fails, all changes of that order are rolled back.
- In a test run the same steps run without commit and return a result list.
- The result is shown per line with status and message in an ALV, failed lines can be downloaded as an error file to correct and reload, and the run is written to the application log.
Performance notes
Group lines by order number, lock each order once and save it with a single commit. For rule lines restrict RESB by material, plant and open status. Run changes for thousands of orders in the background, in packages.
Features
- Export to Excel The template file can be downloaded from the program.
- Test mode (check without posting)
- Line-by-line result and error log
- Download failed lines as a separate file Failed lines are downloaded with their messages to correct and reload.
- Runs as a background job Large files can be processed in the background from a server directory.
Authorization objects
- C_AFKO_AWAOrder change authorization by order type
- C_AFKO_AWKOrder authorization by plant and order type
Frequently asked questions
Why use this program instead of re-reading the order from master data?
Re-reading rebuilds all components and operations of the order from master data; manual changes, batch assignments and, in some cases, confirmed steps cause problems. The program touches only the components named in the file and leaves the rest of the order unchanged.
Are the functions used official BAPIs?
No, there is no released BAPI for order components; the program calls the order buffer functions SAP uses in its own applications. That is why it commits once per order, rolls the order back on error and should be retested after upgrades. The same functions work on S/4HANA on-premise.
What happens to a component that has already been withdrawn?
A withdrawn component is not deleted and its quantity is not reduced below the withdrawn quantity; the line is skipped with a warning. A return movement has to be posted first for such components.
Related reports
BOM Change Log Report with E-mail Alerts
A report that shows component additions, deletions, quantity and validity changes in bills of material in a readable list with who, when and the old …
Mass BOM Component Replacement Upload Program
A custom program that replaces, adds or deletes components or updates quantities in many material BOMs from Excel or CSV rows. Validity is set with a …
Multi-Level BOM Where-Used Report with Open Production Orders
A custom ALV report that shows in which assemblies and, at the top, in which finished goods one or more components are used, as a flat list that …
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.