SapGuiCloseSession Function

Action

This function closes a specified session or all session of the current virtual user.

Include file

SapGui.bdh

Syntax

SapGuiCloseSession( in sSession : string optional );
Parameter Description
sSession The id of the session to be closed. Set this parameter to NULL to close all assigned sessions.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    iCol : number;
    sName : string;
    sConnID : string;
  begin// Connecting to SAP
    sConnID := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU 10.5.2.132 0/3");
    
    SapGuiSetActiveConnection(gsConnID);

    SapGuiSetActiveSession("ses[0]");

    // SAP
    SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_ExactNoCase);

    SapGuiWindowAction(SAPGUI_WND_MAXIMIZE);

    SapGuiLogon("ddic", "*******", "000", "");
    SapGuiCloseSession();
  end TMain;