PP Program Custom development Mass upload

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

  • CO02 Change Production Order. Components are changed manually order by order; no mass file upload.
  • CS20 BOM Mass Change. Changes a component across BOMs in bulk; does not apply the change to existing production orders.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
RESBReservation/Dependent RequirementsOrder components: added, deleted and changed itemsRead / writeECC + S/4
AFKOOrder Header Data for PP OrdersOrder header and reservation numberReadECC + S/4
AFPOOrder ItemOrder item: material and plantReadECC + S/4
AFVCOperation within an OrderOperation the component is assigned toReadECC + S/4
JESTIndividual Object StatusOrder status: technically completed, closed, deletion flagReadECC + S/4
MARCPlant Data for MaterialPlant data of the component materialReadECC + S/4
PRPSWBS Element Master DataWBS element check for project assignmentReadECC + 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

ParameterDescriptionTypeReference fieldRequiredExample
P_FILEUpload file (Excel)Single value—YesC:\temp\bilesen_degisiklik.xlsx
P_WERKSPlantSingle valueAFPO-DWERKYes1000
P_TESTTest runCheckbox—NoX
P_RELAlso change released ordersCheckbox—NoX

Input file columns

The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.

#ColumnTarget fieldRequired
1OrderRESB-AUFNRNo
2Action (A/D/C)By rule A = add, D = delete, C = change; R for a rule lineNo
3OperationRESB-VORNRNo
4Item no.RESB-POSNRNo
5MaterialRESB-MATNRNo
6QuantityRESB-BDMNGNo
7UnitRESB-MEINSNo
8Storage locationRESB-LGORTNo
9WBS elementPRPS-POSIDNo

Sample upload file

1OrderAction (A/D/C)OperationItem no.MaterialQuantityUnitStorage locationWBS element
21004512C00100020HM-204556ADD100
31004512A0010HM-204602ADD100
41004530D00200040HM-11870
51004547C00100010HM-30017P-26-014.02.03
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1OrderRESB-AUFNR
2ActionCalculated Add, delete or change
3MaterialRESB-MATNR
4Old valueCalculated Quantity, storage location or WBS before the change
5New valueCalculated Value from the file
6StatusCalculated Success, test OK, warning or error
7MessageCalculated Function return message or check message

Sample result list

OrderActionMaterialOld valueNew valueStatusMessage
1004512ChangeHM-204554 AD6 ADSuccessComponent quantity updated
1004512AddHM-204602 ADSuccessAdded as item 0050
1004530DeleteHM-1187010 ADWarning4 PC already withdrawn for the component; not deleted
1004547ChangeHM-30017P-26-014.02.01P-26-014.02.03SuccessWBS assignment changed
A view built with fictional sample data; not real system data.

How does the program work?

  1. 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.
  2. 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.
  3. 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.
  4. In a test run the same steps run without commit and return a result list.
  5. 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

PP Report Custom ALV report

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 …

CDHDR · CDPOS · MAST · STKO

PP Program Custom Mass upload

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 …

MAST · STKO · STPO · MARA

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.

Related report: Mass Component Add, Delete and Change in Open Production Orders