Show TOC

Terminating a SessionLocate this document in the navigation structure


If a stateful application needs to perform certain actions before the session is terminated, and before the application is ended by a session timeout, then this application must implement an event handler for the event IF_HTTP_SERVE~EVENTKIND_CONTEXT_TERMINATION.

A session can be terminated for various reasons, including the following:

  • The session has expired

  • An error occurred when the response document was sent.

  • An error occurred when a request document was received, if a session already exists.

In any of these scenarios, those applications that have registered the event IF_HTTP_SERVE~EVENTKIND_CONTEXT_TERMINATION are notified (provided that ICF runtime has control).

Here, the applications must not perform any time-intensive actions, because if an ABAP timeout occurs, the session is terminated without the application being notified. Also, the application must not access the request and response objects of the IF_HTTP_SERVER after being called by an event, as this would cause error entries to be created in the trace files.


There are a number of situations where the application cannot be notified when a session is terminated. These include terminations of a session by the user (for example, when the user chooses Cancel or Stop in the browser) or technical problems.