Connect SAP Through Excel VBA

佐手、 提交于 2020-01-13 19:15:07

问题


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 example given on link below I get an error.

Excel VBA pulling data from SAP NetWeaver

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 from the 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:


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



来源:https://stackoverflow.com/questions/41543972/connect-sap-through-excel-vba

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!