thank you for your great help :-) I've split the BAPI, and now it works as intended.
Original Message:
Sent: 05-09-2025 11:00
From: Sigrid Kok
Subject: BAPI_MATERIAL_SAVEDATA [Loop issue]
Hi Hauke
Most of the script looks like it is mapped correctly, except this section - please change the loop column for material descriptions. Please fix the loop column.

I made that change and had to adjust a number of values, but was able to get it posted in my system.
- I had a material, all descriptions, all alt UOM.
- It was only in one Sales area - the last one
- It was only in one Plat - the last one
- It was in only one valuation area - the last one.
I believe that for a create, you can only specify 1 of each of the plants/sales areas/valuation areas.
Once created, you then have a script to extend the material to other plants & sales areas. That's what you would do manually, as well. So please enter one of each and then create scripts to extend. The good news is, you already know how to do it. :) And I think it will make the inputs easier.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
*Precisely Software Inc.
Original Message:
Sent: 05-08-2025 04:37
From: Hauke S
Subject: BAPI_MATERIAL_SAVEDATA [Loop issue]
Hi Sigrid,
thanks you for your prompt response!
I've attached the Excel sheet with the testinput structure-maybe the issue lies there. I've incorporated your suggestions, unchecked the enqueue and adjusting the loop for the MVKE data to include the header row. If it's not due to the Excel input structure, I'll split the BAPI script finally.
In total, I aim to migrate data for 11,000 materials using this approach. For the implementation into the parent-child structure, which requires loops, I will program a VBA macro.
Best Regards,
Hauke
Original Message:
Sent: 05-06-2025 21:13
From: Sigrid Kok
Subject: BAPI_MATERIAL_SAVEDATA [Loop issue]
Hi Hauke
Overall the script looks good, but I can't tell for sure without some data - even cleansed - particularly because you have so many loops and you shared that only the last one in the loop was committed if I have that right.
A few other tips:
- I would uncheck the enqueue - the commit is required.
- I would ensure the header of the section is in the loop - you didn't have that for the sales areas but you did for the rest of the sections, and it's great you have the group and the X group in the same loop.
You might consider breaking it up to have the looped sections separate and then chain all of the scripts together. However, that's not required - just a way to make it cleaner and easy to reuse. For example if you want to extend the materials, you can reuse the sections that repeat for the extension.
One other question - how much data are you trying to process in one run? Not that there is a limit - just curious.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
*Precisely Software Inc.
Original Message:
Sent: 05-06-2025 12:19
From: Hauke S
Subject: BAPI_MATERIAL_SAVEDATA [Loop issue]
Hi Sigrid,
Thank you for your feedback and for taking a quick look at my script.
My goal with this script execution was to create multiple material numbers, including all the specific short texts, alternative weight units, plants, distribution channels, and valuation areas.
Maybe a multiple loop could be a solution - or maybe it's just too much at once?!
I'm looking forward to your feedback and thank you for your help :-)
Original Message:
Sent: 05-06-2025 12:10
From: Sigrid Kok
Subject: BAPI_MATERIAL_SAVEDATA [Loop issue]
Hi Hauke
Thanks for reaching out. BAPIs are a great choice for migration.
I can take a look at your script later today, but I will need to know what specifically you are trying to accomplish in the script. You mentioned short text and alternate UOM. Note that sometimes it's good to just do one thing - specifically if it's repeating - in each script. But that is up to you.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
*Precisely Software Inc.
Original Message:
Sent: 05-05-2025 08:17
From: Hauke S
Subject: BAPI_MATERIAL_SAVEDATA [Loop issue]
Hi to all,
I wanted to use the Bapi script for a material master data migration.
Unfortunately I struggle with the loops. I can add several material short texts and alternative weight units reliably, but only the last plant and the last sales organisation with the last distribution channel are added and not the first or the second.
I am sure that I have not set the loops correctly and would be very appreciative if someone could give me a tip
BR
------------------------------
Hauke
------------------------------