Share this page

# sapgui_create_new_session

Connection and Session Functions

Creates a new session.

    int sapgui_create_new_session( [optionalArgs,]LAST );

optionalArgs | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

sapgui_create_new_session creates a new session. It is equivalent to choosing Create Session from the System menu.

## Return Values

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.

## Parameterization

Parameterization is not applicable to this function.

## Example

The following example uses sapgui_create_new_session to create a second session on an open connection.

    // Open the connection to the server as the first active connection

    sapgui_open_connection_ex(
            "/SAP_CODEPAGE=1100 /FULLMENU MyServer 00 /3",
            "MyServer",
            "con[0]");

    // Activate the first connection

    sapgui_select_active_connection("con[0]");

    // Activate the first session

    sapgui_select_active_session("ses[0]");

    // Activate the first window (SAP Logon)

    sapgui_select_active_window("wnd[0]");

    // Log on

    sapgui_logon("MyUser", "MyPassword", "800", "EN", LAST );

    // Create a second session

        sapgui_create_new_session(LAST );

    // Make the new session active

    // Note that it is "ses[1]"

    sapgui_select_active_session("ses[1]");

    // Window is per session, so it is "wnd[0]"

    sapgui_select_active_window("wnd[0]");

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