All,
I'm working on an application for my company to run SAP Script, using SAP Scripting API. The application is being programmed in VB.NET from Visual Studio 2015.
When I try to open a Gui Application, I can get all the things I need (GuiApplication, ScriptingEngine, Session 0 etc.), but when I try to set the first field (actually, the user name on the logon screen..) I get an error 0x80010105 (RPC_E_SERVERFAULT). This is the VB.NET code I'm using....
PublicSub RunScript()
Dim ConnectionString AsString = BuildConnectionString()
Dim app AsGuiApplication
Dim mySession AsGuiSession
Try
'Create object wrapper
Dim objWrapper = CreateObject("SapROTWr.SapROTWrapper")
'Get sap GUI using wrapper
Dim objRotSAPGUI = objWrapper.GetROTEntry("SAPGUI")
If IsNothing(objRotSAPGUI) Then
'New instance
app = CType(CreateObject("Sapgui.ScriptingCtrl.1"), GuiApplication)
Else
'running instance
app = CType(objRotSAPGUI.GetScriptingEngine(), GuiApplication)
EndIf
Dim Connection AsGuiConnection = app.OpenConnection("ECC6 EHP7 SR2 on HANA", True)
mySession.FindById("/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-BNAME").text = "USER"
mySession.FindById("/app/con[0]/ses[0]/wnd[0]/usr/pwdRSYST-BCODE").text = "PASSWORD"
mySession.SendCommand("/0")
app = Nothing
Catch ex AsException
EndTry
EndSub
The procedure creates the error when trying to set the user (field txtRSYST-BNAME). Has anybody ever seen that before and solved the issue?
Some parameters from my machine: OS is Windows 10 Enterprise 64bit, dev environment is Visual Studio Enterprise 2015, :Net frame work used is 4.6, the application is compiled for 32 bit. SAP Logon is 7.40, no NWBC installed.
Thanks a lot and best regards,
Werner Buchner