*Precisely Software Inc.
Original Message:
Sent: 05-04-2026 15:17
From: Jeremy Maxfield
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Hi Sigrid,
No, it is not through Loop, as I have never been able to achieve that or known anyone who has been able to get updates across plants/sorgs to script like that.
My goal here was to create a user experience where the end user did not have to repeat the material number / plant combinations that they wanted to extend to. 2nd goal was to not have to create multiple iterations of the same script, each with a different hard coded plant to extend and new run log mapping.
So the first sheet is effectively a control sheet with formulas mapping everything to the respective Plant Ext sheet, as well as the Sales Org Extension sheet. Then the Plant Ext script can run just like a regular Automate script, extending each material to each plant that had been selected on the previous sheet, repeating the same for Sales Org Extension.
I believe something similar could work for Tomasz. with easier maintenance in a web-form.
------------------------------
Jeremy Maxfield
Lead BSA
Chamberlain Group, LLC
Oak Brook IL
Original Message:
Sent: 04-29-2026 16:07
From: Sigrid Kok
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Thanks for sharing, @Jeremy Maxfield I'll take a closer look when I have time.
Are you able to do the updates/posts in a loop across plants and sales orgs, or is it one at a time? That has been the issue here - and it would be for the Transaction and Direct - it can only do one at a time, not in a loop.
Thanks again,
Sigrid
------------------------------
Sigrid Kok
*Precisely Software Inc.
Original Message:
Sent: 04-29-2026 15:13
From: Jeremy Maxfield
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Hi Tomasz & Sigrid,
I had tried a while back to accomplish a full plant/sorg extension in a very similar case and was unsuccessful as well with just a script that did it for me. I ended up having to take the steps below to accomplish what I wanted.
For an excel based form, I ended up creating a matrix for both Plants and Sorgs I wanted to extend to on my main Request sheet. I identified my material, then I create a check for each I wish to deploy.

Then on the respective sheet for each, I used formulas to take the horizontal Request 'X' and mapped via formula to vertically allow the script to run.

The biggest win here is my script is able to run seamlessly for each combination requested, the biggest challenge is maintaining the formulas. I have attached a shareable version of my template that includes the formulas that might at least help Tomasz get something working in short order. If you can think of any improvements I could do to simplify doing a similar request (create/update/extend across various SAP structures), please let me know!
My goal is to eventually put this in an Evolve web-form, as I think it would be easier to manage as we add/remove plants.
------------------------------
Jeremy Maxfield
Lead BSA
Chamberlain Group, LLC
Oak Brook IL
Original Message:
Sent: 04-29-2026 11:44
From: Sigrid Kok
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Hi Tomasz
Thanks for sharing your script.
I am running into the same behavior, and I think I know why.
When you go into the tcode, you have to enter material number, then select the Sales Plant view, fill in the sales plant data and then update your profit center and click Save. The Save ends the interaction and you have to start over when you do it manually, If recording in Transaction, that same Save ends the recording. That means you cannot select another plant and change the profit center in the same interaction/recording.
I believe the BAPI is behaving the same way. It won't let you loop through multiple plants in a single post, so you have to post separately. I now remember someone else asked something similar a few years ago for extensions, and it didn't work in a loop for similar reasons.
Hope that makes sense. If there are any ABAP experts who can add to this, please share.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
*Precisely Software Inc.
Original Message:
Sent: 04-29-2026 01:44
From: Tomasz Tomaszewski
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Hello,
Sure, thank you for taking time to look into this.
Script runs the loop, but updates only the last entry on the file.
BR,
Tomasz
------------------------------
Tomasz Tomaszewski
Self-Registration Shared Account
Original Message:
Sent: 04-28-2026 13:58
From: Sigrid Kok
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Hi Tomasz
Looks like you are close. Can you please share you script? Template too, if it's ok - otherwise no worries.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
*Precisely Software Inc.
Original Message:
Sent: 04-27-2026 10:37
From: Tomasz Tomaszewski
Subject: BAPI_MATERIAL_SAVEDATA to update Profit Center
Hi Experts,
Could you please help with a script? I'm trying to make a direct script to update a profit center and it was a success, but I'd like to make a loop that would make an update to all plant at once and then commit (to save time). I can't figure this out - it doesn't update. Does anyone know what am I doing wrong?

Thank you for your help.
BR,
Tomasz
------------------------------
Tomasz Tomaszewski
Self-Registration Shared Account
------------------------------