I’m trying to get access to various properties and methods of SAP elements (like this) using UIPath Studio.
I can spy SAP elements via studio but they are UiElement type. And I can only access UiElement class methods and properties.
I’ve tried using the invoke code, but cannot make it work. Although similar code works fine in VBA or VBS, I cannot make it work in the UIPath.
The VB.net code is following, this is just a simple connector to an existing SAP instance:
Dim SapGuiAuto As Object Dim SAPApp As GuiApplication Dim SAPCon As GuiConnection Dim session As GuiSession SapGuiAuto = GetObject("SAPGUI") SAPApp = SapGuiAuto.GetScriptingEngine SAPCon = SAPApp.Children(0) session = SAPCon.Children(0)
I’ve imported the ‘sapfewse.ocx’ library into my project to have required references, but I’m keep getting the following error:
Error ERROR Validation Error No compiled code to run
error BC30574: Option Strict On disallows late binding. At line 7
error BC30512: Option Strict On disallows implicit conversions from ‘Object’ to ‘sapfewse.GuiConnection’. At line 8
error BC30512: Option Strict On disallows implicit conversions from ‘Object’ to ‘sapfewse.GuiSession’. At line 9 Main.xaml
Changing all variable types to ‘Object’ doesn’t help either as I only get error about late binding…
I could make external VBS or VBA file script and run it from the Studio, but this is not the way I want to solve it. I would prefer to not use any external files and stick only to the Studio.
Does anyone have any other idea on how to access SAP GUI elements’ properties and methods from the UIPath Studio? Or how to make invoke code working with SAP GUI Scripting?