STOPSESSION Function (Sessions)
Stops a Microsoft Dynamics NAV session.
[OK :=] STOPSESSION(SessionID[,Comment]);
Parameters
- SessionID
-
Type: Integer
The ID of the session that you want to stop.
The session can be any of the following:
-
Microsoft Dynamics NAV Windows client session
-
Microsoft Dynamics NAV Web client session
-
NAS services session
-
SOAP web services client session
-
OData web services client session
-
Background session
-
Microsoft Dynamics NAV Windows client session
- Comment
- Type: Text An optional comment about the session event. The comment is stored in Table 2000000111, the Session Event table.
The session that you want to stop and the session that calls STOPSESSION must be running on the same instance of Microsoft Dynamics NAV Server. The session is stopped before the next C/AL statement executes. Open transactions are rolled back.
Note |
|---|
| If the current executing statement is the SLEEP function, then the session is stopped immediately. |
When a session is executing C/AL that does not interact with the server connection or the access lock used by the connection, STOPSESSION cannot terminate the connection. STOPSESSION can terminate connections that are inactive, idle, or using the database but not blocked.
You cannot stop the current, active session in which you are executing the STOPSESSION call.
This example requires that you create the following variables, and assumes that you have a table named CacheStressTest that you use for testing.
| Variable name | DataType | Subtype |
|---|---|---|
|
SessionId |
Integer |
Not applicable |
|
CacheStressTestRec |
Record |
CacheStressTest |
STARTSESSION(SessionId, CODEUNIT::"Cache Stress Test", COMPANYNAME, CacheStressTestRec); STOPSESSION(SessionId, 'Logoff cache stress test session');
Note