cancel
Showing results for 
Search instead for 
Did you mean: 

GetObject call does no longer find SAPGUI in Running Object Table while GUI scripting in R/3

Jan_Br
Explorer
0 Kudos
220

I have come across a rather annoying bug in GUI scripting when connecting to SAP via GetObject(“SAPGUI”). This bug occurs for me both in Excel VBA as well as with Python3:

At a certain point, a connection to SAP can no longer be established if SAP is opened alternately by script and manually. Some time ago I posted this post on StackOverflow, unfortunately without any answers. At that time, the problem occurred mainly when alternating between manually calling the Logon Pad and the sapshut.exe. Now I have the same problem, although the programmatic start of SAP is also done via the Logon Pad and no longer uses sapshut.exe which I thought was a workaround.

The fastest way to reproduce this behavior is for me:

  1. Start SAP manually via logon (session is open) → connecting script works
  2. Close SAP completely
  3. Open SAP via script (as soon as the logon is there, a connection should be possible) → connecting works
  4. Close SAP completely and open again manually (like 1.) → connecting no longer works
  5. Restarting the computer enables connecting to a manually startet session again

Has anyone ever encountered the same problem? Is SAP perhaps entered differently in ROT and “SAPGUI” is not always fitting?

View Entire Topic
Stefan-Schnell
Active Contributor

Hello @Jan_Br,

welcome in the SAP Community. It seems to be a thorny problem. I remember that there was a similar problem before, or maybe even the same one. Please look at SAP Note 552646 - Sapshortcut: no Scripting, ... It is very old for SAP GUI 6.40 and has no relevance here, but good to know.

On the way you described I could not reproduce the problem. Somtime I was able to see the behavior, but unfortunately I do not know how the status can be achieved. After a restart, everything worked as expected again. I assume that the alternating use of saplogon.exe and sapshcut.exe probably causes the problem, but I can't say that for sure.

What could be possible solutions?

  • Record the behavior with the Windows Steps Recorder to ensure transparency.
  • Contact your technical support team.
  • Open a Service Request at SAP with the component BC-FES-GUI.
  • Perhaps it is also possible for you as workaround to use sapgui.exe instead of sapshcut.exe as alternative.

Best regards
Stefan

Jan_Br
Explorer
Thank you very much for your detailed answer! At least it is somewhat comforting that I am not the only one who has experienced this problem 🙂