Share this page

# sapgui_logon

Connection and Session Functions

Logs on to a SAP server.

    int sapgui_logon( const char *user_name, const char *password, const char *client_num, const char *language, [args,] LAST );

user_name | The name of the user in the session
password | The password of the user in the session
client_num | The identification number of the client
language | The language of the SAP session
args | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

## 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 logs on using the My Connection connection to the R/3 server. My Connection is defined in the SAP client installation. The user name is MyUserName.

Copy code

    Action() {
    // Connect to R/3 server, and log on
    sapgui_open_connection("My Connection", "con[0]");
    sapgui_select_active_session("ses[0]");
    sapgui_logon("MyUserName", "MyPassword", "800", "EN", LAST );
    // Now you can work
        ...
    return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: