Connect SAP on Citrix through Excel VBA

15.2k views Asked by At

I have no direct SAP installed on my machine and using SAP window through below link.

https://nedc-ctx.applications.services.axa-tech.intraxa/Citrix/AccessPlatform/auth/loggedout.aspx

I am aware of Record and Run function of SAP GUI and that is working. I have this access in training version only. In production I am unable to use run and record option.

How do I open SAP window from Excel VBA, connect and load the data?

In code below I get an error.

I found I am unable to add reference file "sapfewse.ocx" on my machine.

Is it possible to connect SAP through Excel VBA if we access SAP through above provided link. After clicking on above link new pop-up window will get connected with SAP with window. SAP is getting connected through Citrix.

Code (taken from this help link):

Set SapGuiAuto  = GetObject("SAPGUI") 'Get the SAP GUI Scripting object
Set SAPApp = SapGuiAuto.GetScriptingEngine 'Get the currently running SAP GUI 
Set SAPCon = SAPApp.Children(0) 'Get the first system that is currently connected
Set session = SAPCon.Children(0) 'Get the first session (window) on that connection

'Start the transaction to view a table
session.StartTransaction "SE16"
1

There are 1 answers

0
JoseS On

The code you provided would only work if you have the SAP GUI installed on your computer. I would suggest asking the IT team if they can provide you the server address so you can use a Remote Function Call to retrieve the data automatically. This can be done with VBA (https://archive.sap.com/discussions/thread/129358) You would need to adapt the code in the link to match your needs