This function closes a specified session or all session of the current virtual user.
SapGui.bdh
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. |
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;