Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

SAP APIs

SAP GUI automation is supported since Sahi Pro SAP Engine.

Modes SAP

Launches SAP GUI logon pad.

Parameters

NameTypeDescription
None
Raw script
_launchSAPGUI();

Sahi Pro Classic API _launchSAPGUI

Modes SAP

Closes SAP GUI logon pad launched earlier using _launchSAPGUI.

Parameters

NameTypeDescription
None
Raw script
_closeSAPGUI();

Sahi Pro Classic API _closeSAPGUI

Modes SAP

Opens the specified SAP GUI connection.

Parameters

NameTypeDescription
$connectionNamestringName of the connection to open
Raw script
_openSAPConnection("Connection1");

Sahi Pro Classic API _openSAPConnection

Modes SAP

Closes the currently open SAP GUI connection.

Parameters

NameTypeDescription
None
Raw script
_closeSAPConnection();

Sahi Pro Classic API _closeSAPConnection

Modes SAP

Opens a new SAP GUI session from the existing SAP GUI session.

Parameters

NameTypeDescription
None
Raw script
_createNewSAPSession();

Sahi Pro Classic API _createNewSAPSession

Modes SAP

Maximizes an existing SAP GUI window having the specified title. If title is not specified, it maximizes the current window.

Parameters

NameTypeDescription
$titlestringoptionalTitle of the window to maximize
Raw script
_maximizeWindow();
_maximizeWindow("Create Order");
_maximizeWindow("/Purchase Order No./");
_maximizeWindow("/Purchase Order No. [0-9]{5}/");

Sahi Pro Classic API _maximizeWindow

Modes SAP

Minimizes an existing SAP GUI window having the specified title. If title is not specified, it minimizes the current window.

Parameters

NameTypeDescription
$titlestringoptionalTitle of the window to minimize
Raw script
_minimizeWindow();
_minimizeWindow("Create Inquiry");
_minimizeWindow("/Purchase Order No./");
_minimizeWindow("/Purchase Order No. [0-9]{5}/");

Sahi Pro Classic API _minimizeWindow

Modes SAP

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

NameTypeDescription
$titlestringoptionalTitle of the window to restore
Raw script
_restoreWindow();
_restoreWindow("Create Order");
_restoreWindow("/Purchase Order No./");
_restoreWindow("/Purchase Order No. [0-9]{5}/");

Sahi Pro Classic API _restoreWindow

Modes SAP

Resizes an existing SAP GUI window having the specified title with the specified dimensions.

Parameters

NameTypeDescription
$titlestringTitle of the window to resize
$widthintegerNew width for the window
$heightintegerNew height for the window
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

Modes SAP

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

NameTypeDescription
None

Returns

mpStatus information object
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

Modes SAP

Selects the specified row(s) in the specified table element.

Parameters

NameTypeDescription
$elementHTML DOM elementTable element
$rowsstringComma separated list of row numbers to be selected
Raw script
_selectRows(_gridView("wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell"), "2,3");

Sahi Pro Classic API _selectRows

Modes SAP

Selects the specified columns in the specified table element.

Parameters

NameTypeDescription
$elementHTML DOM elementTable element
$columnsstringComma separated list of column titles to be selected
Raw script
_selectColumns(_gridView("wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell"), "Price,Order Quantity");

Sahi Pro Classic API _selectColumns

Modes SAP

Submits an HTML form for an _htmlViewer element.

Parameters

NameTypeDescription
$elementHTML DOM elementHtmlViewer element
$frameNamestringName of the parent frame of the HTML form to be submitted
$postDatastringPost data to be submitted
$urlstringUrl to be submitted to the SAP server.
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