Skip to Content
0

How I can run SAP script from Citrix?

Oct 21, 2017 at 09:44 PM

115

avatar image
Former Member

Hi everyone.

In the past I was running SAP scripts without problem, with my user open

Starting the script in this way:

If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If

Now , the IT team changed to Citrix only and my scripts not running more.

Someone can help me to obtain the correct script to run from Citrix?

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

1 Answer

Stefan Schnell
Nov 03, 2017 at 08:51 AM
0

Hello Guillermo,

SAP GUI Scripting works in Citrix environment without any problems. Are you sure that SAP GUI Scripting is installed and enabled? Take a look at your SAP Logon > Options > Accessibility & Scripting > Scripting.

Best regards
Stefan


Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Stefan .

Yes the option is active, is not changed from last time running (before SAP was deleted on my computer).

The problem start when IT team deleted SAP GUI from my computer

And now I can access to SAP only using Citrix

Also I did other test today and is the same result, script is not running

Error on line 2

Below is the short script to test, saved using SAP script record

If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "zqm10"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").setCurrentCell -1,""
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectAll
session.findById("wnd[0]/mbar/menu[0]/menu[3]/menu[1]").select
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[11]").press

sap.png (15.3 kB)
0

Hello Guillermo,

I copied the first 17 lines of your script into my Citrix environment as VBS file, changed the TAC to SE16 and execute it without any errors. I assume your Citrix environment is 64-bit, open a console and type this:

If it is AMD64 it is 64-bit.

What version of SAP GUI do you use? Older versions doesn't support 64-bit COM calls. So you can't execute your script from Explorer directly. Open a console and type this to use 32-bit Windows Scripting Host:

Let us know if it is work.

Cheers
Stefan

001.jpg (14.0 kB)
002.jpg (15.1 kB)
0