SAP Functions
SAP GUI automation is supported since Sahi Pro SAP Engine.
_launchSAPGUI
Section titled “_launchSAPGUI”- Since
- SAP Engine 9.0.0
Modes SAP
_launchSAPGUI()Arguments
| Name | Type | Description |
|---|---|---|
None |
Returns
null |
Launches SAP GUI logon pad.
_launchSAPGUI();_closeSAPGUI
Section titled “_closeSAPGUI”- Since
- SAP Engine 9.0.0
Modes SAP
_closeSAPGUI()Arguments
| Name | Type | Description |
|---|---|---|
None |
Returns
null |
Closes SAP GUI logon pad launched earlier using _launchSAPGUI.
_closeSAPGUI();_openSAPConnection
Section titled “_openSAPConnection”- Since
- SAP Engine 9.0.0
Modes SAP
_openSAPConnection($connectionName)Arguments
| Name | Type | Description |
|---|---|---|
$connectionName | string | Name of the connection to open |
Returns
null |
Opens the specified SAP GUI connection.
_openSAPConnection("Connection1");_closeSAPConnection
Section titled “_closeSAPConnection”- Since
- SAP Engine 9.0.0
Modes SAP
_closeSAPConnection()Arguments
| Name | Type | Description |
|---|---|---|
None |
Returns
null |
Closes the currently open SAP GUI connection.
_closeSAPConnection();_createNewSAPSession
Section titled “_createNewSAPSession”- Since
- SAP Engine 9.0.0
Modes SAP
_createNewSAPSession()Arguments
| Name | Type | Description |
|---|---|---|
None |
Returns
null |
Opens a new SAP GUI session from the existing SAP GUI session.
_createNewSAPSession();_maximizeWindow
Section titled “_maximizeWindow”- Since
- SAP Engine 9.0.0
Modes SAP
_maximizeWindow([$title])Arguments
| Name | Type | Description |
|---|---|---|
$title | stringoptional | Title of the window to maximize |
Returns
null |
Maximizes an existing SAP GUI window having the specified title. If title is not specified, it maximizes the current window.
_maximizeWindow();_maximizeWindow("Create Order");_maximizeWindow("/Purchase Order No./");_maximizeWindow("/Purchase Order No. [0-9]{5}/");_minimizeWindow
Section titled “_minimizeWindow”- Since
- SAP Engine 9.0.0
Modes SAP
_minimizeWindow([$title])Arguments
| Name | Type | Description |
|---|---|---|
$title | stringoptional | Title of the window to minimize |
Returns
null |
Minimizes an existing SAP GUI window having the specified title. If title is not specified, it minimizes the current window.
_minimizeWindow();_minimizeWindow("Create Inquiry");_minimizeWindow("/Purchase Order No./");_minimizeWindow("/Purchase Order No. [0-9]{5}/");_restoreWindow
Section titled “_restoreWindow”- Since
- SAP Engine 9.0.0
Modes SAP
_restoreWindow([$title])Arguments
| Name | Type | Description |
|---|---|---|
$title | stringoptional | Title of the window to restore |
Returns
null |
Restores an existing SAP GUI window having the specified title from its minimized state. If title is not specified, it restores the current window.
_restoreWindow();_restoreWindow("Create Order");_restoreWindow("/Purchase Order No./");_restoreWindow("/Purchase Order No. [0-9]{5}/");_resizeWindow
Section titled “_resizeWindow”- Since
- SAP Engine 9.0.0
Modes SAP
_resizeWindow($title, $width, $height)Arguments
| Name | Type | Description |
|---|---|---|
$title | string | Title of the window to resize |
$width | integer | New width for the window |
$height | integer | New height for the window |
Returns
null |
Resizes an existing SAP GUI window having the specified title with the specified dimensions.
_resizeWindow("Create Order", 800, 400);_resizeWindow("/Purchase Order No./", 380, 250);_resizeWindow("/Purchase Order No. [0-9]{5}/", 640, 300);_getStatusInformation
Section titled “_getStatusInformation”- Since
- SAP Engine 9.0.0
Modes SAP
_getStatusInformation()Arguments
| Name | Type | Description |
|---|---|---|
None |
Returns
mp | Status information object |
Gets the status information from the status bar of the current SAP GUI window. It returns the status message, message type, message id, message number. It also returns up to eight parameters of the status message.
// Read status informationvar $statusInfo = _getStatusInformation();var $statusMessage = $statusInfo.Message; // e.g Inquiry 10000267 has been savedvar $statusMessageType = $statusInfo.MessageType; // e.g Success, Information, Warning, Error, Abortvar $statusMessageId = $statusInfo.MessageId;var $statusMessageNumber = $statusInfo.MessageNumber;var $statusMessageParameter0 = $statusInfo.MessageParameter0;var $statusMessageParameter1 = $statusInfo.MessageParameter1;var $statusMessageParameter2 = $statusInfo.MessageParameter2;var $statusMessageParameter3 = $statusInfo.MessageParameter3;var $statusMessageParameter4 = $statusInfo.MessageParameter4;var $statusMessageParameter5 = $statusInfo.MessageParameter5;var $statusMessageParameter6 = $statusInfo.MessageParameter6;var $statusMessageParameter7 = $statusInfo.MessageParameter7;
// Verify status messagevar $pattern = "/^Inquiry (.*) has been saved$/";_assertEqual($pattern, $statusMessage);
// Extract inquiry number from status messagevar $inquiryNumber = _extract($statusMessage, $pattern, true);_selectRows
Section titled “_selectRows”- Since
- SAP Engine 9.0.0
Modes SAP
_selectRows($element, $rows)Arguments
| Name | Type | Description |
|---|---|---|
$element | HTML DOM element | Table element |
$rows | string | Comma separated list of row numbers to be selected |
Returns
null |
Selects the specified row(s) in the specified table element.
_selectRows(_gridView("wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell"), "2,3");_selectColumns
Section titled “_selectColumns”- Since
- SAP Engine 9.0.0
Modes SAP
_selectColumns($element, $columns)Arguments
| Name | Type | Description |
|---|---|---|
$element | HTML DOM element | Table element |
$columns | string | Comma separated list of column titles to be selected |
Returns
null |
Selects the specified columns in the specified table element.
_selectColumns(_gridView("wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell"), "Price,Order Quantity");_htmlFormSubmit
Section titled “_htmlFormSubmit”- Since
- SAP Engine 9.0.0
Modes SAP
_htmlFormSubmit($element, $frameName, $postData, $url)Arguments
| Name | Type | Description |
|---|---|---|
$element | HTML DOM element | HtmlViewer element |
$frameName | string | Name of the parent frame of the HTML form to be submitted |
$postData | string | Post data to be submitted |
$url | string | Url to be submitted to the SAP server. |
Returns
null |
Submits an HTML form for an _htmlViewer element.
_htmlFormSubmit(_htmlViewer("wnd[0]/usr/cntlHTML/shellcont/shell"), "Frame1", "FirstName=John&LastName=Smith", "sapevent:SUBMIT_FORM_AS_POST_METHOD");
