2

last week I asked a question about having issues running macros with SAP GUI scripts contained within on other people's PCs. I have gotten some updated information that I believe changes the question fundamentally so I will repost.

I made a macro series, one of which extracts data from the SAP system and imports it into Excel. While it runs smoothly on my computer, it begins going haywire the second it gets to a SAP GUI recorded script portion when used on anyone else's PC. At first I believed this may be an issue between servers but upon experimenting I have found the following.

I recorded this particular portion on three separate computers and 3 separate SAP GUI logins. This piece simply selects a specific field in order to input a particular number.

  1. My Computer
    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/usr/ctxtRIWO00-QMNUM").Text = Cells(i + 2, 5)
    session.findById("wnd[0]/usr/ctxtRIWO00-QMNUM").caretPosition = 9
    session.findById("wnd[0]/tbar[1]/btn[25]").press
    
  2. Co-Worker 1
    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/usr/ctxt").Text = Cells(i + 2, 5)
    session.findById("wnd[0]/usr/ctxt").caretPosition = 9
    session.findById("wnd[0]").sendVKey 0
    
  3. Co-Worker 2
    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/tbar[1]/btn[7]").press
    session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell/shellcont[1]/shell[1]").selectItem "          2","C          6"
    session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell/shellcont[1]/shell[1]").ensureVisibleHorizontalItem "          2","C          6"
    

Now as you can see, the first 2 codes are similar but with slight differences. Neither of these codes will run on any other computer besides the one that they were recorded on.

The last code is very different but runs universally on every computer. We are not sure why this is but I need the same capability to be able to create shareable macros for my company.

Has anyone seen this issue before? Does anyone recognize why these codes might be so different? Maybe a hidden setting?

Thanks for your help guys.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Jordan
  • 363
  • 4
  • 23

1 Answers1

0

From my recent personal experience, it is due to poor implementation/maintenance of SAP by your company. Assuming things were fine when you first adopted SAP, this may be due to non-universal updates. In my case, things are slightly different between menus. One window may automatically close on one computer but not another (workaround by using "on error," but this shouldn't be required). I would simply use the bottom scripting technique and attribute the two former to SAP configurations that haven't been updated. Your SAP development/maintenance team should be able to give you an exact answer, but if they are anywhere near as friendly/knowledgeable as ours: "Good luck"

Robpagan
  • 19
  • 2