Show TOC Entering content frame

Function documentationLifetime Management Locate the document in its SAP Library structure

Use

The lifetime management controls the lifetime of a custom control at the frontend.  When a control reaches the end of its lifetime, the SAP system automatically destroys it at the frontend.  The methods free and finalize are called by the system for the control.  However, you can also destroy a control yourself by calling these methods in your program.

Features

You set the lifetime of a control when you create the control instance. There are two possible settings:

·        my_control->lifetime_imode: The control remains alive for the lifetime of the internal session (that is, until a statement such as leave program or leave to transaction) The statements set screen 0. leave screen. only destroy the internal session if no more screen instances exist (for example, created using call screen).  After this, the finalize method is called.

·        my_control->lifetime_dynpro: The control remains alive for the lifetime of the screen instance, that is, for as long as the screen remains in the stack. After this, the free method is called.

Using this mode automatically regulates the visibility of the control. Controls are only displayed when the screen on which they were created is active. When other screens are active, the controls are hidden.

·        my_control->lifetime_default: If you create the control in a container, it inherits the lifetime of the container. If you do not create the control in a container (for example, because it is a container itself), the lifetime is set to my_control->lifetime_imode.

Caution

When you specify the lifetime of a control, it may be shorter, but never longer, than that of its container.

Note

An instance of a screen is defined as follows:

An instance is created when a screen is placed on the screen stack (for example, using call screen 100 (starting at…), or call transaction), or when it is the defined next screen in a screen sequence (whether set statically or dynamically).

An instance is destroyed when the next screen is a screen other than that of the current instance (set screen 200 or set screen 0).

The lifetime of a control is specified in the attribute my_control->lifetime.

You can use the method is_alive to find out if an instantiated control still exists at the frontend.  The method get_living_dynpro_controls returns a list of all controls that currently exist on the frontend.


 

Leaving content frame