on 08-31-2011 8:18 AM
Hi
I am working on a script which logs on and off automatically on several SAP systems. It is run out of excel and worked fine when using SAP Logon Pad 710. The same script does not work when using SAP Logon Pad 720. Then I got many problems, some of them I want to describe.
First, some lines of the code where the problems occur.
shell STR_SAP_COMMAND & Cells(ROW_PATH, COL_PATH) '' start SAP Logon Pad
Call StartLogon
...
Set SapGuiAuto = GetObject("SAPGUI")
Set SapguiApp = SapGuiAuto.GetScriptingEngine
Set Connection = SapguiApp.OpenConnection(strServer, True, True)
I am calling the saplgpad.exe with the additional /INI_FILE parameter, which is a path to an ini file containing the SAP systems.
After that the script opens a connection to a server (parameter strServer, is read out of the excel sheet).
Above code worked fine when using version 710 of the Logon Pad. Then I tested it on a machine using Logon Pad 720 and the code failed when executing the OpenConnection method, error message was Error description not found.
Hours of troubleshooting later, the code works, I don't know why, the only thing is that I get another error when executing the GetObject("SAPGUI"):
Runtime Error -2147221020 (800401e4)
Automation Error
Invalid syntax
(got the message in german, so I tried to translate it )
It seems, that the script is trying to execute the GetObject method, even though SAP logon pad is NOT fully loaded (previous call of shell ...). When I resume the code now, the method can be executed an everything works fine. Can or do I have to "synchronize" the call of shell, so that the script continues only if logon pad has been started completely? It seems, that the script executes "too fast".
Now I tried a different solution for logging on via script using following code (I do not execute the saplgpad.exe anymore):
Set Application = CreateObject("Sapgui.ScriptingCtrl.1")
Set Connection = Application.OpenConnection(strServer, True, True)
The question here is, which ini file is used? I mean, where does the script lookup the description of the server, since I have not specified any ini file because I do not call the lgpad.exe as above.
Another issue is that the SAP window is opened in classic design. I already added excel.exe and wscript.exe to the applications in SAP GUI settings, but still it uses the old design.
Well, I hope somebody can help me with one or more of my problems, many thanks for reading the text.
Hi override...
for the last of yoour Problems:
The question here is, which ini file is used? I mean, where does the script lookup the description of the server, since I have not specified any ini file because I do not call the lgpad.exe as above.
Another issue is that the SAP window is opened in classic design. I already added excel.exe and wscript.exe to the applications in SAP GUI settings, but still it uses the old design.
If im not totally wrong it should be the same ini as used for logon pad...
So it is in my case ...
For the Design - that Problem is the same to me ( didnt find any Solution until now), but otherwise - if I'm using Scripting im using another System as used in my "normal" Transactions
since we have more than one Server ID's to logon
When I'm through with Scripting the system is closed and everything is fine again...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.