Skip to Content
0

How to work with SAP script to open SAP logon pad?

Aug 29, 2017 at 09:40 PM

77

avatar image
Former Member

Hi All,

I am trying to work towards automating a task using SAP script and everything is setup except SAP logon.

My script works fine when SAPlogon.exe (logon pad) is open. I am trying a workaround where my script opens SAP logon pad when logon pad already is not open and then rest of my script kicks in and perform its task.

Here is my code...

If Not IsObject(application) Then (usually any sap script will start with this code and mine also works if logon pad is open beforehand)

Set SapGuiAuto = GetObject("SAPGUI") (if logon pad is not open and i execute the script i get Incorrect Syntax at this line)

Set application = SapGuiAuto.GetScriptingEngine

SID = InputBox("Please enter SID to login") (Here i am asking user to enter SID of system on which they want to login)

Else (Below code should kick in case above If statement is not taken effect)

Set WshShell = CreateObject("WScript.Shell")

MsgBox "Looks like SAPlogon is not started, Do you want to start?" (Just for fun)

Set proc = WshShell.Exec("C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe")

WScript.Sleep 4000

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

SID = InputBox("Please enter SID to login")

End If

rest of script......

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers