Automate

 View Only
Expand all | Collapse all

Switched positions in Unit of Measure

  • 1.  Switched positions in Unit of Measure

    Posted 12-03-2019 09:55
      |   view attached
    Hi,

    In transaction MM02 I want to enter length width and height in UoM for Case.
    Then i want to enter a quantity in UoM for Pallet.
    It seems that the positions from Case and Pallet can switch when numbers are changing, see picture.
    What can I do to be sure that the right data goes to right line?

    Regards, Tom

    ------------------------------
    Tom Schurink |
    Signify |
    ------------------------------


  • 2.  RE: Switched positions in Unit of Measure

    Employee
    Posted 12-03-2019 15:45
    Hi Tom

    Because SAP doesn't provide find options, as you have found, this either requires:
    • GUI scripting, using an Indexed IF on the alternate UOM
    or
    • BAPI to update the unit of measure using Direct with BAPI_MATERIAL_SAVEDATA
    Let me know what you prefer.  I probably have examples of both.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    pse | Winshuttle North America
    ------------------------------



  • 3.  RE: Switched positions in Unit of Measure

    Posted 12-04-2019 07:56
    Hi Sigrid,

    i'm not authorized to use BAPI, so I would appreciate if you could help me with a GUI script.

    Regards,
    Tom

    ------------------------------
    Tom Schurink |
    Philips Lighting |
    ------------------------------



  • 4.  RE: Switched positions in Unit of Measure

    Posted 12-05-2019 04:32

    Hi Sigrid,

    I'm facing the same issue. Would it be possible to provide both examples?

    Best Regards,

    Koen



    ------------------------------
    Koen Everaerts |
    Aveve NV |
    ------------------------------



  • 5.  RE: Switched positions in Unit of Measure

    Employee
    Posted 12-03-2019 16:12
    Hey Tom,

    Looks like Sigrid may have beat me to the punch, but I've put together a quick script that uses BAPI_MATERIAL_SAVEDATA to either add or update alternate units of measure. If it exists, it will update it, if not, it will create it.

    Hope this helps! I'll be putting some more work into this to make it Winshuttle Template ready too!

    - James

    ------------------------------
    James Lofgren | Solutions Engineer
    Winshuttle North America | [City] |
    ------------------------------



  • 6.  RE: Switched positions in Unit of Measure

    Posted 12-04-2019 08:05
    Hi James,

    Thanks for your quick response, but I'm not authorized using BAPI so I can't use your files.

    Regards,
    Tom

    ------------------------------
    Tom Schurink |
    Philips Lighting |
    ------------------------------



  • 7.  RE: Switched positions in Unit of Measure

    Employee
    Posted 12-05-2019 08:51
    Hi Tom

    Here are the steps to recording using GUI scripting:
    1. swap recording mode to GUI scripting
    2. enter you material number and then choose to clear default views so they don't get in the way and select basic data 1
    3. click additional data and select units of measure tab
    4. there will be a pop-up that you might have to alt-tab to search for - you'll want to use it identify disabled fields, i.e. the alt unit of measure, because it's disabled/read only - click it
    5. You'll get a temporary red box around the unit of measure.  Once you do, click the pop-up again, because you don't need to capture any more read only fields.  then change the values for that row - whatever you want to change.  Just record one row.  Back out and save the material.  Then you must log off SAP to end the recording

      You'll see something like this in Studio  - notice the alternate unit of measure has a download selected, because you can't change it.

      Go to expert view and find where you have the alternate unit of measure and highlight all of the fields below that belong to that row, because you're going to put an IF around it.
      Choose to add an IF and then select Indexed IF and choose the alternate unit of measure field from the list

      then you want to compare it to a column value that you'll pass in - choose the column
      you'll want to then disable the download of the alternate unit of measure field
      put a loop around it if you want to update more than one
      then finish mapping and save
      it will look something like this
      Note this will ONLY do an UPDATE.  If you want to ADD alt units of measure, you'll need to use an Indexed Loop - which enters a new unit of measure on the next available row.

      Example attached - built with v12.1. 

      Happy scripting
      Sigrid











    ------------------------------
    Sigrid Kok
    pse | Winshuttle North America
    ------------------------------



  • 8.  RE: Switched positions in Unit of Measure

    Posted 12-08-2019 11:59
      |   view attached
    Hi Sigrid,

    Thanks for the file and explanation, but I'm getting an error saying: "Script could not be attached to SAP GUI"
    It seems that GUI scripting is not configured correctly.

    I have no authorisation for transaction RZ11.
    I use Studio 12.1 and SAP 740 with patch  level 8, this is probably not ok?

    Regards, Tom

    ------------------------------
    Tom Schurink |
    Signify |
    ------------------------------



  • 9.  RE: Switched positions in Unit of Measure

    Posted 12-09-2019 10:41
    Hi Sigrid,

    My problems seemed to be a VPN issue, today at work I could do the GUI scripting.

    I got to manage one UoM row, see attached file, but how to proceed with the next UoM row?

    Regards, Tom

    ------------------------------
    Tom Schurink |
    Signify |
    ------------------------------



  • 10.  RE: Switched positions in Unit of Measure

    Employee
    Posted 12-10-2019 08:53
    Hi Tom

    GUI scripting needs to be turned on.  Otherwise, you need to get permission to use the BAPI, which is what I would recommend.

    For the example I sent, you use an indexedif to find the right row.  You can use a loop to process more than one, which was also in the example I sent you.

    We cannot provide individualized services on the Community site - only examples and recommendations.  You have a few options:

    - You can review the online training that is available on how to use GUI scripting, or Direct if you can use the BAPI.  The link is on the community site.  If you don't have access, please open a support ticket to get a login.
    - You can also engage with our Services team for personalize assistance.  Please check with your Winshuttle rep if you want to go that route.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    pse | Winshuttle North America
    ------------------------------



  • 11.  RE: Switched positions in Unit of Measure

    Posted 12-11-2019 03:07
    Hi Sigrid,

    I did use the loop, that's why I'm surprised that the first item changes but the second item is not.
    I will see if the online training will give some answers, thanks for your help.

    regards,
    Tom

    ------------------------------
    Tom Schurink |
    Signify |
    ------------------------------



  • 12.  RE: Switched positions in Unit of Measure

    Employee
    Posted 12-11-2019 09:16
    HI Tom

    Please do look at the training.  It will help you learn how to approach these types of scripts. 

    I would recommend you run the script in debut mode to see what is happening with the subsequent items.

    You could also remove the loop.  Make sure you have everything you need inside your indexed if, and have it run for multiple rows.  Then add the loop around it.  In other words, do it in steps/stages, so that you can make sure it's all working before adding the next part.
    Make sure you have the change material inside the IF and the loop, and before the back button is hit to return from the additional data.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    pse | Winshuttle North America
    ------------------------------