Automate

 View Only
Expand all | Collapse all

ME22 - Adding Freight Conditions to lines item - user is already processing PO

  • 1.  ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 11-23-2020 08:45
    Hello All
    I created Script which can add up to 3 new Freight Conditions on selected PO line. I used ME22 instead of ME22N as it was easier for me. My script enters 1 line at a time. So If I have to inject freight conditions to other PO lines, script goes again, opens PO, selects another line, adds freight conditions and exits and so on. I am not using LOOP option, as data formating for it would be too much time consuming. 




    However despite that Gui scripting is slower than other types, sometimes it is fast enough to get an error(I am E38052): 
     
    So not always but sometimes despite exiting previously from PO and opening it again, it is still locked by myself. Can something be done here to solve this? Or rather shall I just remove such errors from log and run script again with "Unprocessed Only" ? Thanks for all ideas upfront!

    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------


  • 2.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 11-23-2020 09:48
    Hi Robert,

    You can definitely choose the run option to run only errros.

    You might also consider using the developer option to do a pause between posts - aka upload delay, if the issue is because SAP is still processing the prior record when the next one starts to execute.  This is the option I'd recommend.  The script will run a little slower, but you'll have less chances the error will happen.

    Hope that helps,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 3.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 11-23-2020 10:10
    BTW, Robert, you could use a BAPI instead, as BAPI_PO_CHANGE is fairly straight forward. 

    I'm attaching an example in case you want to try it.  It just updates the condition lines.  Note for change type I is insert, but it seemed to work to both add and update the lines.
    SAP

    Best Regards,
    Sigrid


    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 4.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 11-23-2020 10:16
    Hi Sigrid,
    Thanks for both ideas! I will test both Run option and Delay option.
    I would use BAPI and LOOP but time spent on formatting is not worth it :).

    My GUI Sripts takes very small amount of time to develop input file for my teammates, as they generate report, and do copy paste.

    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------



  • 5.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 11-23-2020 10:30
    You're welcome, Robert. 

    Please note you can delete the loop in the BAPI on the Expert tab to post each condition individually.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 6.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 11-23-2020 12:12
    Hi Sigrid,
    Can you tell me more? How the data set would look in Excel then? Am I correct to understand that I can use BAPI to select correct PO Line to which Freight Conditions should be added/edited? I used GUI Scripting specifically to select appropriate (index match) line item and then enter conditions tab. If there is more efficient solution I am very happy to check it :).

    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------



  • 7.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 11-24-2020 11:36
    Hi Robert

    The BAPI will let you add or update or even delete individual conditions, regardless where they are located in the list of conditions.  You can either enter data in the loop, as I shared yesterday,  or do it one condition at a time for a PO or set of POs.  

    I modified the script I posted to do one line at a time - looking at line item 20
    SAP shows:

    So use the change type to determine what to do.  You can do an SAP looking in BAPIs starting in 12.1 and you'll see the choices
    I'm not certain the difference between E & D, and I & J.  I would use I, U and D for Insert, Update and Delete.  I've tried all 3, and they work.

    BAPIs are your friend - especially with grids where there is no way to find a specific line - and when you want something to run faster.   :) 

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 8.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 11-25-2020 02:14
    Hi Sigrid,
    That looks wonderful. Can I look at your script in TXR to check how you recorded that? Or maybe there are some videos showing it. This would actually be very handy for me and the team :)!

    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------



  • 9.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 11-25-2020 10:27
    Hi Robert
    Glad it looks like what might work.  Please note it's the BAPI script I attached earlier without the loop.  You can go to the expert mode tab and delete it and tweak the mapping.
    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 10.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 11-26-2020 06:18
    Hi Sigrid,
    The case is I cannot see any attachments in your posts. And I am super curious how I can add this Change Type and Condition Item columns. When I record using BAPI I am failing at the line selection resolution. It would be beneficial for me to know how to develop such solution as I will definitelly want to use it in different scripts as well :). 

    This is how my WInshuttle recorded line selection(column B) using BAPI and it does not work anyway :) : 



    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------



  • 11.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 11-30-2020 10:11
    Hi Sigrid,
    Any instructions / tips how I can record to have this fields? I still find it very useful however have no idea how it can be re-created in my Winshuttle. If there is Webinar/Tutorial/any other topic which can be helpful to undertsand it please let me know :). Thanks!



    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------



  • 12.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 12-01-2020 08:58
    They're BAPI fields that I showed, Robert.  Example attached.

    If you want to use GUI scripting, you'll have to use a column with a "code" that says what to do and then use IF logic.

    FYI,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 13.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Employee
    Posted 12-01-2020 08:56
    BAPI example attached with loop.

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 14.  RE: ME22 - Adding Freight Conditions to lines item - user is already processing PO

    Posted 12-01-2020 09:01
    Thank you Sigrid! I will try to make use of that :)!

    ------------------------------
    Robert Dudziak | Senior Procurement Operations Analyst
    Kimberly-Clark Corporation |
    ------------------------------