Automate

 View Only
  • 1.  Looping Help Needed (Not T-Code Specific)

    Posted 01-08-2020 18:03
      |   view attached
    Hello All!

    I was wondering if anyone has been able to do something like this and are willing to share.

    We are on Studio/Transaction (we are currently on 11.2.18), but not sure if that matters.

    I have a SAP T-Code that contains a table that I would like the script to determine the variable number of rows to update and make an same update to all those rows. 

    My example is for ME22N, there are a variable amount of Items/Materials that I need to update the Delivery Date & Time with the same Date/Time for all the items in the PO.  To update the Time, I need to select each row and open the Item details to get to the Time field, but I would need to know each material and have that on my data file to update them all.  My hope is to only need the PO number, Date and Time fields on the data file, where the script would go in and make that same adjustment to the Date and Time fields for all the Items/Materials that exist.

    Loops need a Header/Detail line on the data file, but the hope was to not need this, or at the very least, have 1 H (for the PO) and 1 D (for the Date/Time).  I quickly looked at GUI Script around Index SAP field, but I still need to have the script update all the Item rows where I do not want a user to have to know and add to the data file.  This could be for any T-Code with a table that has a variable number of rows (like MM02 UOM as another example if I wanted to update all the Alt UOM row's Numerators to 2 - never would happen, but same concept)

    Everything I come up with is I will have to bring a Query into play, but I wanted to see if anyone else came across this before.

    Thanks!

    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------


  • 2.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 02:06
    Hi Scott,

    In this case it is better to use the functionality in ME21N instead of WinShuttle.
    Select the row that you want to adjust and clcik on the Fast Change button.

    Best regards,
    Maarten Fondse


    ------------------------------
    Maarten Fondse | SAP MM-SD Consultant
    Woger Trading International | 024 7410741
    ------------------------------



  • 3.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 15:50
    Thanks Maarten!  

    I did find the Fast Change will update the Delivery Date field, but it does not have the option for Time.  It looks like it only updates the fields in the middle section of ME2XN.  Unless I am missing something?

    Thanks again!

    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------



  • 4.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 16:45
    Scott, 

    That is correct the fast change logic is for the PO lines and not the PO scheduled lines.  You would need to find line then go to scheduling to change the time.  You are not missing anything.  

    Best,
    John



    ------------------------------
    John Nickerson | SAP Winshuttle Functional Consultant
    ID Foods Corporation | 514-975-8696
    ------------------------------



  • 5.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 07:46
    Hey Scott,

    I believe we've had several team members work with ME22N recently. I'll ask them to give their input.

    ------------------------------
    Joshua Whitener | Technical Advisor
    Exxon Mobil Corporation | 8326258441
    ------------------------------



  • 6.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 12:33
    Hi Scott,

    I recommend that you create a query on EKKO, EKPO, and EKET to get open lines.   Then record with ME22 not ME22N in batch mode.  No need to loop.  Just use the lines mode  do not record for the loop / header / lines.   Then publish the query script and then publish the transaction script using the same data file.

    Have buyers go to the Winshuttle tab in the Excel data file calling the Query first and run.  They update the delivery date and planned time for lines desired on the datasheet using the Excel change column information.   Then they run the update script.  The lines with changes will be changed and the lines with no changes will be ignored, SAP will message no changes made, no big deal.

    As for changing alternate UOM, I have the data team use the Wnshuttle script that I created using MM17 on the table MARM with select on the alternate unit of measure and then go to the first line in the change view enter the new value and then press save.  I do not use the carry-out change function. 

    Hope this helps.

    John


    ------------------------------
    John Nickerson | SAP Winshuttle Functional Consultant
    ID Foods Corporation | 514-975-8696
    ------------------------------



  • 7.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 16:25
    Thanks John!

    Yeah, I was trying to avoid doing a Query and Transaction combination. 

    I thought there was a way to build a Transaction script to look at the next row of a table and if there is a value in a designated field of the row (not null), that it would move to that next row and update it, but I could not remember if it was real or a dream.  The key I am looking for is the cycle through a variable number of rows without having to build the script to accommodate 100 rows when there could be a PO with 1 Material or 100.

    Thanks again!


    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------



  • 8.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 15:27
    Hi Scott,

    You can certainly do a loop in transactions with tables like ME22N by changing the data in the item section and using the arrow key for next item. This will keep you from needing an item number or material to filter by. However, you'll still need a detail row for each purchase order item that you want to change.

    ------------------------------
    Melanie Shaffar | Winshuttle Solutions Engineer
    Exxon Mobil Corporation | 832-625-9196
    ------------------------------



  • 9.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-09-2020 16:29
    Thanks Melanie!

    I like the arrow option, but how do I adjust the script to know how many times to hit it?  I could have a PO with one Item and another with 30 Items and I was hoping to avoid the person filling out the file from needing to know there are 26 items on this PO, for example.

    Thanks!

    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------



  • 10.  RE: Looping Help Needed (Not T-Code Specific)

    Posted 01-16-2020 12:22
    To kind of close this topic, at least circle back letting you know what I did do.

    I ended up doing a combo of Query and Direct (BAPI_PO_Change) scripts, with some Excel formulas, to make it as easy for the end user and what I was looking to do.   Let me know if you wish more details.

    If someone could still provide an option of how to get one script to cycle through a SAP table when there are a variable number of rows with data, to update those rows until it reaches an empty row, I would appreciate it.

    Have a good one all!

    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------