
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.
You can access the following objects in the implementation toolbar:
|
Object |
Reference Type |
Description |
|
APPLICATION |
type ref to application class |
The Application class means the individual application class entered 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 |
Defined in interface IF_BSP_RUNTIME is the runtime object. |
|
PAGE |
type ref to IF_BSP_PAGE |
Defined in interface IF_BSP_PAGE is the page object. |
|
PAGE_CONTEXT |
type ref to IF_BSP_PAGE_CONTEXT |
Defined in interface IF_BSP_PAGE_CONTEXT is the page context object. |