SAP APIs
abstract
SAP GUI automation is supported since Sahi Pro SAP Add-on.
Launches SAP GUI logon pad.
Parameters
None |
Return Value
Modes Supported :
Raw Script
_launchSAPGUI();
Sahi Pro Classic API :_launchSAPGUI
Closes SAP GUI logon pad launched earlier using
_launchSAPGUI
.
Parameters
None |
Return Value
Modes Supported :
Raw Script
_closeSAPGUI();
Sahi Pro Classic API :_closeSAPGUI
Opens the specified SAP GUI connection.
Parameters
$connectionName | string | Name of the connection to open |
Return Value
Modes Supported :
Raw Script
_openSAPConnection("Connection1");
Sahi Pro Classic API :_openSAPConnection
Closes the currently open SAP GUI connection.
Parameters
None |
Return Value
Modes Supported :
Raw Script
_closeSAPConnection();
Sahi Pro Classic API :_closeSAPConnection
Opens a new SAP GUI session from the existing SAP GUI session.
Parameters
None |
Return Value
Modes Supported :
Raw Script
_createNewSAPSession();
Sahi Pro Classic API :_createNewSAPSession
Maximizes an existing SAP GUI window having the specified title. If title is not specified, it maximizes the current window.
Parameters
$title | string optional | Title of the window to maximize |
Return Value
Modes Supported :
Raw Script
_maximizeWindow();
_maximizeWindow("Create Order");
_maximizeWindow("/Purchase Order No./");
_maximizeWindow("/Purchase Order No. [0-9]{5}/");
Sahi Pro Classic API :_maximizeWindow
Minimizes an existing SAP GUI window having the specified title. If title is not specified, it minimizes the current window.
Parameters
$title | string optional | Title of the window to minimize |
Return Value
Modes Supported :
Raw Script
_minimizeWindow();
_minimizeWindow("Create Inquiry");
_minimizeWindow("/Purchase Order No./");
_minimizeWindow("/Purchase Order No. [0-9]{5}/");
Sahi Pro Classic API :_minimizeWindow
Restores an existing SAP GUI window having the specified title from its minimized state. If title is not specified, it restores the current window.
Parameters
$title | string optional | Title of the window to restore |
Return Value
Modes Supported :
Raw Script
_restoreWindow();
_restoreWindow("Create Order");
_restoreWindow("/Purchase Order No./");
_restoreWindow("/Purchase Order No. [0-9]{5}/");
Sahi Pro Classic API :_restoreWindow
Resizes an existing SAP GUI window having the specified title with the specified dimensions.
Parameters
$title | string | Title of the window to resize |
$width | integer | New width for the window |
$height | integer | New height for the window |
Return Value
Modes Supported :
Raw Script
_resizeWindow("Create Order", 800, 400);
_resizeWindow("/Purchase Order No./", 380, 250);
_resizeWindow("/Purchase Order No. [0-9]{5}/", 640, 300);
Sahi Pro Classic API :_resizeWindow
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.
Parameters
None |
Return Value
mp | Status information object |
Modes Supported :
Raw Script
// Read status information
var $statusInfo = _getStatusInformation();
var $statusMessage = $statusInfo.Message; // e.g Inquiry 10000267 has been saved
var $statusMessageType = $statusInfo.MessageType; // e.g Success, Information, Warning, Error, Abort
var $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 message
var $pattern = "/^Inquiry (.*) has been saved$/";
_assertEqual($pattern, $statusMessage);
// Extract inquiry number from status message
var $inquiryNumber = _extract($statusMessage, $pattern, true);
Sahi Pro Classic API :_getStatusInformation
Selects the specified row(s) in the specified table element.
Parameters
$element | HTML DOM element | Table element |
$rows | string | Comma separated list of row numbers to be selected |
Return Value
Modes Supported :
Raw Script
_selectRows(_gridView("wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell"), "2,3");
Sahi Pro Classic API :_selectRows
Selects the specified columns in the specified table element.
Parameters
$element | HTML DOM element | Table element |
$columns | string | Comma separated list of column titles to be selected |
Return Value
Modes Supported :
Raw Script
_selectColumns(_gridView("wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell"), "Price,Order Quantity");
Sahi Pro Classic API :_selectColumns
Submits an HTML form for an
_htmlViewer
element.
Parameters
$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. |
Return Value
Modes Supported :
Raw Script
_htmlFormSubmit(_htmlViewer("wnd[0]/usr/cntlHTML/shellcont/shell"), "Frame1", "FirstName=John&LastName=Smith", "sapevent:SUBMIT_FORM_AS_POST_METHOD");
Sahi Pro Classic API :_htmlFormSubmit