sapgui_open_connection_ex
| Connection and Session Functions |
Opens a connection to the SAP server specified by a connection string.
int sapgui_open_connection_ex( const char *connection_string, const char *connection_name, const char *connection_id, [args,] LAST );| connection_string | A unique string identifying the SAP server. |
| connection_name | A name for the connection, defined in the SAP client installation. |
| connection_id | The connection identifier |
| args | Optional Arguments |
| LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used. |
The sapgui_open_connection_ex function opens a connection to the server defined by the connection_string. The function sets the output parameter connection_id. This parameter is used in sapgui_select_active_connection.
sapgui_open_connection_ex should be followed by sapgui_logon.
Return Values
This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.
Note: If a logon or connection in a script fails, the script replay is aborted. You can allow the script replay to continue despite a failed logon or connection by enabling the following setting in the runtime settings: SAPGUI > General > Advanced > Disable abort on logon/connection.
Parameterization
You can parameterize all string (char type) arguments.
Example
The following example uses sapgui_open_connection_ex to initialize the channel to the R/3 server.
Action() {// Connect to R/3 server, and log on
sapgui_open_connection_ex (
ConnectionString="/SAP_CODEPAGE=1100 /FULLMENU myServer 00 /3",
Description="MYSERVER",
ConnectionID="con[0]")
sapgui_select_active_connection("con[0]"); sapgui_select_active_session("ses[0]"); sapgui_select_active_window("wnd[0]");// logging on as MyUserName
sapgui_logon("MyUserName", "MyPassword", "800", "EN", LAST );lr_think_time(4);
// Now you can work
...
return 0;
}

