Hi Russell
Here's an idea in two parts - the Query generates the H/D for the loop ID, and the BAPI will have the line item data twice - once outside of the loop for the H row, and once for the detail rows by copying that part.
(1) Query - use a formula based on the sales document number field

My output starts on row 5, so compare sales doc # on row 5 and compare to previous row, row 4. If different, make the loop ID column H, otherwise D
Now your output has H and D, with the first D line on the H row. ex:

(2) in the sales order BAPI, remove the default loops from the line items rows in Expert mode - it will handle the first detail row on the header (H) line

now right click on the green line for Order_Item_In and select copy

then paste at the bottom. Do the same for Order_Item_InX. Put a loop around that, as it will handle the detail lines.

If you're using other line item tables, ensure you do the same - once outside of the loop for the header row and again in the loop for the detail line.
Hope that helps,
Sigrid
------------------------------
Sigrid Kok
PSE | Winshuttle NA
------------------------------
Original Message:
Sent: 05-12-2022 08:50
From: Russell Wright
Subject: Changing many Sales orders and Changing Popups
We have a lot of sales orders that need the material number changed.
So I download the orders that need changed into Excel along with the relevant fields.
When I record the script for an order, the script will run for all orders that have the same popups, but if the order has a different popup at a different time, the script fails, as you would expect it to.
How can I manage the popups changing?
I can't see having to create a series of scripts, I don't find a way to change the recording.
I looked at the BAPI suggestion, but downloading the data through a query doesn't seem to lend itself to loops. Unless there is way that I haven't found through searching, yet.
Can anyone offer any suggestions, templates or help?
Thank you
------------------------------
Russell Wright | DP MGR
Tamko Building Products | 4176246644
------------------------------