
OnDestroy
Use
This event handler runs immediately before the page instance is deleted and is therefore the exact opposite of
OnCreate. You can use it to execute closing actions for a page.
Since locks and so on are reset in ABAP, this event handler is not usually required and is therefore rarely used.
With stateful processing, the event handler OnDestroy is not called in every request-response cycle and the page object is not destroyed. OnDestroy is only called right at the end when you switch back to stateless processing. With stateless processing, both OnCreate and OnDestroy are called for every request-response cycle.
This event handler is therefore called in very rare cases, for example if an application is stateful and the controller’s lifetime is shorter. The system then explicitly destroys the controller and calls the corresponding method.
You can use this event handler in connection with server-side cookies, for example: Using OnCreate you can load the cookie and then (at the end of the process flow) you use OnDestroy to store it again so that the information held in the cookie does not get lost.
Functions
You can access the following objects in the implementation:
|
Object |
Reference Type |
Description |
|
APPLICATION |
type ref to application class |
Application class refers to the individual application or application class specified in the BSP application. If there is no application class in the BSP application, this means that the object application is not available. |
|
RUNTIME |
type ref to IF_BSP_RUNTIME |
The runtime object is defined in interface IF_BSP_RUNTIME . |
|
PAGE |
type ref to IF_BSP_PAGE |
Page object is defined in interface IF_BSP_PAGE. |
|
PAGE_CONTEXT |
type ref to IF_BSP_PAGE_CONTEXT |
Page context object is defined in interface IF_BSP_PAGE_CONTEXT. |