SAP GUI Scripting 1 – Running scripts from Excel

This video covers SAP GUI Scripting basics, recording a script and running it from MS Excel using my example.

The Excel example shown in this video can be downloaded from:

Excel 2010 version of the code:

48 thoughts on “SAP GUI Scripting 1 – Running scripts from Excel

  1. Great video, thanks!
    Quick question, If i have a value already in SAP and want to copy and paste it into another field in SAP, is there an easy way write that into the macro, as it will not record copy and paste.

  2. Hi Mentor! First of all I want to thank you for sharing your knowledge about Macro with SAP scripting. I am really greatful for that because I have created a lot of scripting.

    I was able to adopt your codes here but I just have 1 question. I am working on to change asset on SAP transaction code AS02.

    It is working perfectly fine if I have data on the cells from excel that I want to change on AS02 but, if there's no data on cell, SAP will copy the blank cell to the look up field in SAP.

    Is it posible to skip populating the SAP data if the excel cell is empty?

    Thank you so much for your help!

  3. hi varga, i tried building one more macro with more variables (columns). The macro works but it picks only the 1st line (11th row) it comes back to SAP with the same value and stops. it does not move to the next line. can you please help me?

  4. Hi sir.. I'm trying to automate few check points in manual Purchase order creation apart from catalogue. My simple check point is to check vendor is XK03 with corporate group.
    Please help me how can I run it macro..

  5. hi could you please anyone help me to call sap gui script directly from excel, Now what i am able to call like first i have to open record and play sap pop up and then click play button and then select excel file and after opening excel than i can run the script but i want to run directly from excel no need to open first from sap

  6. Csongor Varga, excelent video. I downloaded a Sap 740 version. I would like to get or access Sample Data for testing porpouses. Do you have any link where I can aim my Sap gui? thanks in advance

  7. Thank you very much for the post. I tried to download the sample file so I can follow along, but came up short. Could you please download it the cloud again and share the link with me.

    I have developed a similar code and was wondering how could I copy data from SAP to Excel. I tried "Objsheet" method but it doesn't seem to be working. Would you please explain how could this be accomplished in brief?

    Awaiting your valuable feedback 🙂

  8. Hi Csongor,
    Content is very helpful.
    References which u have shown is not reflecting in my Excel.
    How can we add that reference or is there any alternate way to proceed further?
    Need your assistance.

  9. Hi Mr. Varga, Thanks for your reply. Today I have faced a new challenge. I wanted to automate a process where I need to open multiple transaction codes in separate windows and work simultaneously. But I was unable to do that. The problem I had, I recorded the steps but GUI scripting unable to identify the id of the elements. So My question is, is it possible to automate such kind of steps? Please help.
    Another thing I want to know, how to scrape the status bar massage. Looking forward to your help.
    Thanks again,

  10. is there a way of running scripts local/client only without server option? Moving the menu's around like that shouldn't be Dependant on the server. This is what is freaking out the place i work for, they are worried at backend issues and wont enable the scripting. If i could show them that this is only local then they might enable it.

  11. Please, Can you explain how to make automation script wich will do: copy vendor code from excel paste it to sap, press enter, take reference number from excel paste it to sap dialogue, press enter and one more time, line by line from excel to sap?

  12. Hi Csongor, this is an incredible alternative to WinShuttle and on top of that it is completely free. Is there a possibility to minimize or hide the window of the connected session (or even better execute the session in the background)? I've seen "objSess.findById("wnd[0]").Maximize" but it doesn't do the trick. This might come in handy performance wise and prevent incorrect entries through finger trouble. Thanks Chris

  13. Hi Varga,Great video. Thanks.Is there possibility you help me?I tried to procees the same for SAP SE16N where I need to add many documents numbers  which are in excel , and I tried to run below formula:If objSheet.Range("G:G" & Range("A" & Rows.Count).End(xlUp.Row)) <> "" Then
       MULTI_SELECT = bjSheet.Range("G:G" & Range("A" & Rows.Count).End(xlUp.Row))should add the documents numbers in SAP before run the codeunfortunately, didnt work =))

  14. Hi Varga,

    When I try executing the script, it pops out an error saying "User defined type – not defined" at the line
    "Public objGui As GuiApplication". Can you please help me here.

  15. Great tutorials, yours codes are really helping me.
    Am able to process my work but am stuck at one I need to print through sap and am able call the print code but am unable to automate printer dialogue box. so is there any vbscript to control the printer dialogue box.
    kindly help

  16. Hello, I'm from Mexico and I liked these videos of the topic. Thank you so much.
    I've tried to extract data from Excel and I can't because when I run the macro in Excel
    it shows me the MsgBox "No active session to system…" in the method "Attach_Session".

  17. hi this s very interesting, do we have code for attaching PDF from system drive to list of documents in fb03 and mir4 t code also do we have code for fb60 posting. thank u in advance

Leave a Reply

Your email address will not be published. Required fields are marked *