Start SAP Session

Starts the SAP application indicated by the user, using a Connection String.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

startSAPSession [--applicationpath(String)] --connectionstring(String) --clientid(String) --username(String) --password(String) --language(String) (SAPSession)=sapsession (Window)=value (Numeric)=processId (Boolean)=success


  • The environment needs to have the SAP® software.
  • Clean the %temp% directory before running a bot via schedule.

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Path applicationpath Optional Text Path to the SAP application started.
Connection String connectionstring Required Text Connection string with the data needed to connect the SAP GUI to the SAP server.
Client ID clientid Required Text Client ID.
Password password Required Text User's password to connect to the server.
Language language Required Text The language used in the SAP application following the ISO 639-1 format.

Output parameter

Designer mode label Script mode name Accepted variable types Description
SAP Session sapsession SAP Session Returns the current attached SAP session.
Window value Window SAP window open on connection.
Process ID processId Number SAP application process id.
Success success Boolean Returns true if the session was started, otherwise returns false.


Starts a new SAP session

defVar --name windowApplication --type Window
defVar --name idApplication --type Numeric
defVar --name successStart --type Boolean
// Opens the informed SAP application, with username, password and customer id, in English.
startSAPSession --applicationpath "path\\sap.exe" --connectionstring "Connection string" --clientid 001 --username username --password password --language en windowApplication=value idApplication=processId successStart=success
logMessage --message "${successStart}" --type "Info"
// Returns a Boolean variable, indicating the success of the initialization.
// The script is just an example with information on how to use the command.


  • The connection data may vary depending on the infrastructure used. For example, an SAP GUI connection string to a server can be made up of the SAP server's application IP and the port number for communication, such as "/H/".

  • Setting credentials in IBM RPA Studio options takes effect only when using the recorder. The production robot does not use IBM RPA Studio settings.