cancel
Showing results for 
Search instead for 
Did you mean: 

SAP GUI Scripting - C# can't get session

Former Member
0 Kudos

I am trying to use standard sample to get active session:

SapROTWr.CSapROTWrapper sapROT = new SapROTWr.CSapROTWrapper();
object objSapGui = sapROT.GetROTEntry("SAPGUI");
object objEngine = objSapGui.GetType().InvokeMember("GetScriptingEngine", System.Reflection.BindingFlags.InvokeMethod, null, objSapGui, null);
SapGuiApp = objEngine as GuiApplication;
var sapconnections = SapGuiApp?.Connections
               .Cast<GuiConnection>().ToList();

I can get connection, but see that sapconnections.FirstOrDefault().Sessions.Count or sapconnections.FirstOrDefault().Children.Count equals to 0.

Even if I am loggined in and can see window:

PS: probably session information is getting lost after Cast<GuiConnection>()

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Seems that scripting was disabled on server side. Now session is getting catched. Strange. I was sure that I have enabled scripting on server side. May be also permission to record scripts was also required(?) - i have set this time this permission to true also.

Answers (0)