Example: sapgui_create_new_session

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]");