cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPGUI Scripting Full Documentation

Former Member
0 Likes
4,679

Hi,

Does anyone know where I can find a full documentation for SAPGUI scripting?

I have been using late binding in VBA and copying codes from recorded SAPGUI scripts into VBA but it would be much better if I can have a full list of available objects and methods to work with.

Thank you

Regards

Jay

View Entire Topic
Sandra_Rossi
Active Contributor

From SAP GUI, menu "SAP GUI Scripting Help" below "Script Recording and Playback".

Or online here: https://help.sap.com/viewer/product/sap_gui_for_windows/760.02/en-US?q=SAP%20GUI%20Scripting%20API

Or online here: https://archive.sap.com/documents/docs/DOC-8971

EDIT July 16th 2020 : also in menu "SAP GUI Scripting Help" of SAP GUI

daniel_mccollum
Active Contributor
0 Likes

I'd always gone to the help from the GUI

I like the PDF more 🙂

Sandra_Rossi
Active Contributor
0 Likes

daniel_mccollum you say "the help from the GUI", but I'm not aware that the documentation of "SAP GUI Scripting API" is available in the SAP GUI help... (there's only the help for SAP GUI end user, not help for developer)

Former Member
0 Likes

Thank you Sandra,

I have been using the below code in my VBA macros to connect the SAPGUI.

Dim SapGuiAuto, SapApp, SapCon, Session As Object

'Initiate SAP Connection 
Set SapGuiAuto = GetObject("SAPGUI") 
Set SapApp = SapGuiAuto.GetScriptingEngine 
Set SapCon = SapApp.Children(0) 
Set Session = SapCon.Children(0)

I have read the PDF document before but the objects and methods in it don't seem to be available in VBA.

Could you show me how to use them in VBA please?

Thank you very much

Regards

Jay

Sandra_Rossi
Active Contributor
0 Likes

I don't understand what PDF you guys are all talking about... (the only PDF I see is "The SAP GUI Scripting API", presentation by Cohrs and Loff, which doesn't talk about objects and methods, other documents are in HTML or CHM format).

The preferred language is VBS, not VBA. If you want to use SAP GUI Scripting with VBA (i.e. via macros within MS Office applications), it should work with MS Office 32 bits, but not 64 bits unless you use the method explained in the note 2689304 - Usage of SAP GUI Scripting ROT Entry Helper (saprotwr.dll) by 64bit applications, which corresponds to the "DLL Surrogate" approach.

daniel_mccollum
Active Contributor

Seems like you've already updated this in the edits.
Opens the local file.

Former Member
0 Likes

Thank you Sandra.

Sorry I can't access the link.

I'm a newbie in this and don't really understand what "DLL Surrogate" means. 😛

At the moment, I'm using the SAPGUI script recorder to record VBS code and then copy them into my VBA code, which all use the method "FindByID".

If I understood this correctly, it seems the "FindByID" method is the only method available for Office 64 bits?

Sandra_Rossi
Active Contributor
0 Likes

Jay Geng "All use the method FindById" just because your recorded actions were simple and didn't imply other methods. It generates VBS code. VBS works by running the VBS file from Windows File Explorer from instance.

VBA looks like VBS, but it's not VBS. If you copy the VBS source code to a VBA macro, it may NOT work at all as I explained.

By the way, maybe you have other problems with your code. Could you explain what error message you get, at what line?

Sandra_Rossi
Active Contributor
0 Likes
Daniel McCollum Thanks. It's a CHM file in my SAP GUI installation, not a PDF.