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....
Public
Sub
RunScript()
Dim
ConnectionString
As
String
= BuildConnectionString()
Dim
app
As
GuiApplication
Dim
mySession
As
GuiSession
Try
'Create object wrapper
Dim
objWrapper = CreateObject(
"SapROTWr.SapROTWrapper"
)
'Get sap GUI using wrapper
Dim
objRotSAPGUI = objWrapper.GetROTEntry(
"SAPGUI"
)
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
Hi Stefan,
thanks for the fast reply. You are right, the code to retrieve session 0 from the connection is missing, but I just forgot to copy it to SCN. It's available in the application. This is the complete code:
Public
Sub
RunScript()
Dim
ConnectionString
As
String
= BuildConnectionString()
Dim
app
As
GuiApplication
Dim
mySession
As
GuiSession
Try
'Create object wrapper
Dim
objWrapper = CreateObject(
"SapROTWr.SapROTWrapper"
)
'Get sap GUI using wrapper
Dim
objRotSAPGUI = objWrapper.GetROTEntry(
"SAPGUI"
)
Another observation I has yesterday is that I can get the field (read it's values), but not set the text attribute. Maybe this helps to find the root cause.
Thanks a lot,
Werner
Hello Werner,
I tried it with SAP GUI 7.30 PL14 and Microsoft Visual Basic Compiler Version 11.0.50938.18408 as console application, your program works perfect.
Unfortunately I have no 7.40 SAP GUI available at the moment, but I will check it this evening and reply again.
Cheers
Stefan
Hi Stefan,
I tried with the same GUI/patch level yesterday, and on my environment it didn't work.
Being frustrated, I did a new recording of a script from SAPGUI, and got a big surprise.... even recording scripts on Windows 10 didn't work with GUI 7.40 PL5.... and executing a script I recorded earlier on a Windows 8.1 environment didn't work either. The GUI scripting engine failed giving me a message from Windows scripting host.
Summary: I think that SAP GUI scripting with Windows 1o has a massive issue...
Cheers,
Werner
Hello Werner,
based on your post I installed Windows 10 with SAP GUI 7.40 PL4 to try some tests. First of all I compiled your VB.NET program and it works absolut fine and perfect.
Also I test some script creations and I transfer the scripts to a Windows 7 environment with SAP GUI 7.40 PL5. I execute the scripts in the Windows 7 environment and all works fine without any problems.
I can not confirm your statement that the combination of Windows 10 and SAP GUI Scripting has massive problems. In my case I hava absolut no problems, all works well and as expected.
Cheers
Stefan
Hi Stefan,
some very good news over the weekend. I now can also confirm that GUI Scripting API works with Windows 10 (Enterprise 64bit, even with latest Microsoft patches to version 1511). Also the latest GUI (7.40 compilation 2) works on that OS.
Thanks a lot for your tremendous support the last week.