Class GuiApplication
Entry point. Represents the running SAP GUI application.
Equivalent to the VBA GuiApplication object obtained via
SapROTWr.CSapROTWrapper.GetROTEntry("SAPGUI").GetScriptingEngine().
public class GuiApplication : GuiComponent
- Inheritance
-
GuiApplication
- Inherited Members
Properties
ActiveSession
Returns the currently focused (active) GuiSession.
Equivalent to the VBA application.ActiveSession shortcut.
public GuiSession ActiveSession { get; }
Property Value
Exceptions
- InvalidOperationException
Thrown when SAP reports no active session.
ConnectionCount
Number of active server connections.
public int ConnectionCount { get; }
Property Value
Version
SAP GUI version string, e.g. "750" or "760".
public string Version { get; }
Property Value
Methods
Attach()
Attaches to the currently running SAP GUI instance. SAP GUI must be open and scripting must be enabled.
public static GuiApplication Attach()
Returns
Exceptions
GetConnections()
Returns all active server connections.
public IReadOnlyList<GuiConnection> GetConnections()
Returns
GetFirstConnection()
Gets the first available connection (convenience helper).
public GuiConnection GetFirstConnection()
Returns
GetFirstSession()
Gets the first session of the first connection (convenience helper).
Equivalent to the VBA one-liner:
application.Children(0).Children(0)
public GuiSession GetFirstSession()
Returns
OpenConnection(string, bool)
Opens a connection to an SAP system described by description
(the system entry name as configured in the SAP Logon Pad).
Equivalent to the VBA application.OpenConnection(description).
After calling this method, use GetConnections() or ActiveSession to obtain a usable GuiSession.
public GuiConnection OpenConnection(string description, bool sync = true)
Parameters
descriptionstringThe SAP Logon Pad system entry name, e.g.
"PRD - Production".syncboolWhen true (default), the call blocks until the logon screen is ready. Pass false for asynchronous open.
Returns
- GuiConnection
The newly opened GuiConnection.