Namespace SapGui.Wrapper
Classes
- AbapRuntimeErrorEventArgs
Arguments supplied when AbapRuntimeError fires.
- EndRequestEventArgs
Arguments supplied when EndRequest fires. Indicates that a server round-trip has completed.
- GuiApplication
Entry point. Represents the running SAP GUI application. Equivalent to the VBA
GuiApplicationobject obtained viaSapROTWr.CSapROTWrapper.GetROTEntry("SAPGUI").GetScriptingEngine().
- GuiButton
Wraps a SAP GUI push button (GuiButton).
- GuiCalendar
Wraps a SAP GUI calendar control (
GuiCalendar). Calendar controls appear in date selection dialogs and some screen elements.
- GuiCheckBox
Wraps a SAP GUI check box (GuiCheckBox).
- GuiComboBox
Wraps a SAP GUI drop-down/combo-box (GuiComboBox).
- GuiComponent
Base class for all SAP GUI scripting objects. Wraps the raw COM object and provides safe property access via late binding.
- GuiConnection
Represents a single server connection inside SAP GUI. A connection can have multiple sessions (windows).
- GuiContextMenu
Wraps a SAP GUI context menu (GuiContextMenu) that appears on right-click.
- GuiGridView
Wraps an ALV Grid View control (GuiGridView). This is the most common grid type in modern SAP transactions.
- GuiHTMLViewer
Wraps a SAP GUI HTML viewer control (
GuiHTMLViewer). These controls embed an HTML page (or web application) inside a SAP screen and are used for, e.g., web-based selection helps or BI content.
- GuiLabel
Wraps a SAP GUI label / display field (GuiLabel).
- GuiMainWindow
Represents a SAP GUI window (main window, modal dialog, etc.). Equivalent to VBA
GuiFrameWindow/GuiMainWindow.
- GuiMenu
Wraps a single SAP GUI menu or sub-menu entry (GuiMenu / GuiSubMenu).
- GuiMenubar
Wraps the SAP GUI menu bar (GuiMenubar). To navigate to a menu item, use SelectItem(GuiSession, string) or call
session.Menu("wnd[0]/mbar/menu[0]/menu[1]").Select()directly.
- GuiMessageWindow
Wraps a SAP GUI modal message / popup dialog (GuiMessageWindow). These appear when SAP shows a system message that requires user confirmation, e.g. "Document saved", "Are you sure?", error dialogs.
- GuiRadioButton
Wraps a SAP GUI radio button (GuiRadioButton).
- GuiScrollContainer
Wraps a SAP GUI scroll container (
GuiScrollContainer). Scroll containers appear around screen areas that exceed the available window space and expose vertical and/or horizontal scrollbars.
- GuiScrollbar
Lightweight wrapper around a SAP GUI scrollbar COM object (
GuiScrollbar). Returned by VerticalScrollbar and HorizontalScrollbar.
- GuiSession
Represents a single SAP GUI session (one window / logon). This is the primary object used for day-to-day automation.
Equivalent to the VBA
GuiSessionobject.
- GuiSessionInfo
Read-only snapshot of
GuiSessionInfoproperties.
- GuiShell
Generic typed wrapper for SAP GUI shell controls (
GuiShell). Shell controls are a family of ActiveX-based SAP controls — including ALV grids, trees, calendars and others — that all reportType = "GuiShell"at the base level. More specific shells (e.g.GuiGridView,GuiTree) are already wrapped by their own classes; this wrapper acts as the typed fallback for any shell variant that is not yet individually wrapped, giving you a named type instead of the bare GuiComponent base.For shell types that are not specifically wrapped, access properties and methods via RawObject or
session.findById(id)which returns dynamic.
- GuiStatusbar
Wraps the SAP GUI status bar (GuiStatusbar).
- GuiTab
Wraps a single tab page inside a GuiTabStrip.
- GuiTabStrip
Wraps a SAP GUI tab strip control (GuiTabStrip). Contains one or more GuiTab children.
- GuiTable
Wraps a classic ABAP-rendered SAP GUI table control (GuiTable). For ALV grids use GuiGridView instead.
- GuiTextField
Wraps a SAP GUI text field (GuiTextField, GuiCTextField, GuiPasswordField, GuiOkCodeField).
- GuiToolbar
Wraps a SAP GUI application toolbar (GuiToolbar). This is the row of icon buttons at the top of a screen.
- GuiTree
Wraps a SAP GUI tree control (GuiTree). Tree controls appear in, e.g., the Easy Access menu or transport organizer.
- GuiUserArea
Wraps the SAP GUI user area (
GuiUserArea), which is the content region of a dynpro screen — typically found atwnd[0]/usr.Exposes FindById(string) so that you can address child controls using relative IDs instead of always qualifying from
wnd[0]/usr/….
- HealthCheckResult
Returned by HealthCheck().
- RetryPolicy
Configures and executes retry behaviour for SAP GUI operations.
Obtain an instance via WithRetry(int, int):
session.WithRetry(maxAttempts: 3, delayMs: 500).Run(() => { session.WaitReady(); session.TextField("wnd[0]/usr/txtFoo").Text = "value"; });Retries on SapComponentNotFoundException (slow screen loads) and TimeoutException (session still busy). Never retries on SapGuiNotFoundException — that is a fatal setup error.
- SapAgentBlockedException
Thrown when the SAP agent coordinator is blocked by a safety rule (e.g.
ReadOnlyMode, blocked transaction code, or destructive action guard).
- SapAgentResolutionException
Thrown when
FieldFinderorButtonFinderin the agent layer cannot resolve a semantic target to a SAP GUI element.
- SapComponentNotFoundException
A component with the given ID could not be found in the current session.
- SapGuiClient
Top-level entry point for SAP GUI automation.
Typical usage (C#):
using var sap = SapGuiClient.Attach(); var session = sap.Session; session.StartTransaction("SE16"); session.TextField("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").Text = "MARA"; session.PressEnter(); var status = session.Statusbar(); Console.WriteLine(status.Text);Typical usage (VB.NET for UiPath Invoke Code activity):
Dim sap As SapGuiClient = SapGuiClient.Attach() Dim session As GuiSession = sap.Session session.StartTransaction("MM60") session.TextField("wnd[0]/usr/txtS_WERKS-LOW").Text = "1000" session.PressEnter()
- SapGuiHelper
Convenience helper with static, dependency-free methods designed for use in UiPath Invoke Code and Code Activity activities.
All methods perform a fresh
Attach()on every call, which is safe for UiPath workflows where the activity runs in a single-threaded activity context without keeping state between activities.Example (UiPath Invoke Code – VB.NET):
' Set a text field SapGuiHelper.SetText("wnd[0]/usr/txtRSYST-BNAME", "myuser")' Read a text field Dim val As String = SapGuiHelper.GetText("wnd[0]/usr/txtRSYST-BNAME")
' Press Enter SapGuiHelper.PressEnter()
' Start a transaction SapGuiHelper.StartTransaction("MM60")
- SapGuiNotFoundException
SAP GUI is not running, or scripting is not enabled.
- SessionChangeEventArgs
Arguments supplied when Change fires. Carries a snapshot of the screen after a server round-trip completes.
- StartRequestEventArgs
Arguments supplied when StartRequest fires. Indicates that SAP GUI is beginning a server round-trip.
Enums
- SapComponentType
Maps the SAP GUI scripting
Typestring to an enum for convenient switch/pattern matching in .NET code. Only the most common component types are listed here; the string value is always available via TypeName.
- SapLogLevel
Severity levels for SapLogAction delegates. These mirror LogLevel so that custom delegates can map them to any logging framework without importing
Microsoft.Extensions.Loggingin the consuming project.
Delegates
- SapLogAction
A lightweight logging delegate for integrating SapGui.Wrapper log output into any logging framework, without requiring a dependency on
Microsoft.Extensions.Loggingin the consuming project.Pass an instance to Attach(SapLogAction?, SapLogLevel, ILogger?) or LaunchWithSso(string, bool, int, SapLogAction?, SapLogLevel, ILogger?).
Examples:
// Console output SapGuiClient.Attach(logAction: (level, msg, ex) => Console.WriteLine($"[{level}] {msg}{(ex is null ? "" : " – " + ex.Message)}"));// Serilog static Log class (no ILogger needed) SapGuiClient.Attach(logAction: (level, msg, ex) => Serilog.Log.Write(ToSerilogLevel(level), ex, "{Message}", msg));
// UiPath Invoke Code activity (Log() is the built-in UiPath logging action) SapGuiClient.Attach(logAction: (level, msg, _) => Log($"[SAP] {msg}"));