1

Is there a way to view the properties on SAP GUI objects?

Like this:

Properties drop-down for Workbook object

But for SAP objects like the following ones:

Set SAPGuiAuto = GetObject("SAPGUI")
Set App = SAPGuiAuto.GetScriptingEngine
Set Connection = App.Children(0)
Set SAPSession = Connection.Children(0)

I ask this after reading the last part of the answer to this post: VBA general way for pulling data out of SAP

If however you want to use early binding so that your VBA editor might show the properties and methods of the objects you are using, you need to add a reference to sapfewse.ocx in the SAP GUI installation folder.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
MonoColorado
  • 29
  • 1
  • 1
  • 7
  • If you've declared your variables as explicit types after adding a reference to the SAP object model then you should be seeing what you want. Did you do that? – Tim Williams Apr 12 '18 at 16:53
  • You mean to add `Option Explicit` as the first line of the code? If yes, I had already done that and it did not work. – MonoColorado Mar 26 '19 at 19:07

3 Answers3

5

This is something so badly advertise by the SAP team, they should definitely do a better job there.

Basically you first of all need to add a reference to the SAP object model, the libraries that VBA will understand. Don't know how familiar are you with there references to object models. Basically, on your VBA Editor, click Tools, then References, then Browse, and find this file: "C:\Program Files\SAP\FrontEnd\SAPgui\sapfewse.ocx" (or possibly "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\sapfewse.ocx").

Now you'll be able to browse it on the Object Explorer (press F2 in the VBE), and declare the types.

You need now to familiarise yourself with the Types of this library. Some hints, they all start with Gui, like, GuiSession, GuiApplication, GuiConnection, GuiBlabla... Names are pretty explicit and intuitive.

Nelson Vides
  • 443
  • 4
  • 11
0

To add on to what @Nelson_Vides has said. As he said, you will need to reference the sapfewse.ocx file, and you can view the class objects by pressing F2.

However, the IntelliSense will only be visible once you define an object from the SAP class library.

Dim userArea As GuiUserArea ' <-- For example

Now, whenever the object is used the IntelliSense will show up.

enter image description here

Best of luck and happy scripting!

Scott Ridings
  • 744
  • 1
  • 8
  • 14
-1

SAP also provides documentation on their GUI objects:

enter image description here

mherzog
  • 1,085
  • 1
  • 12
  • 24