Skip to Content
-1
May 21, 2020 at 03:19 PM

Not able to get hold of session in SAP

1134 Views

Hello Experts,

I am very new to SAP and first time i am trying to automate the GUI using C#

Version is SAP GUI 730

I have two issues

1. The new connection created is not appearing in saplogon.ini file

2. I am not getting the session even though i have logged into the SAP

What library i am using to automate:

Here for automation I am using SAP.GUI.Scripting.net which basically a .net version of the below

- saprotwr.dll : ROT Wrapper - sapfewse.ocx : Controls library

SAP landscape :

Scripting enabled in GUI but scripting is not enabled in server (requested but may take time)

Procedure :

a) started the process saplogon.exe

b) trying to get the session so that i can enter the credentials to login

I am getting an error when taking the GUI session from connection, there is no session associated with the connection

_sapGuiApplication = GetSAPGuiApp(secondsOfTimeout);

_sapGuiApplication.OpenConnectionByConnectionString(server);
var index = _sapGuiApplication.Connections.Count - 1;
this._sapGuiConnection = _sapGuiApplication.Children.ElementAt(index) as GuiConnection;
index = _sapGuiConnection.Sessions.Count - 1;
this._sapGuiSession = _sapGuiConnection.Children.Item(index) as GuiSession;

can somebody help me with this?

Regards,

Deepak