Show TOC

OnCreateLocate this document in the navigation structure

Use

OnCreate is used when a page is called for the first time, and performs a once-off data initialization or object creation.

OnCreate is called each time that the BSP page class is created. You can therefore initialize the page object (in object-oriented thought, this corresponds to the constructor). OnCreate initializes the parts of the object that are created once and then used for the entire lifetime of the object, such as the online shopping basket.

create object shopbasket.

The data that is used to fill the object is read in the event handler OnInitialization.

The BSP application is called in the following cases:

  • Single call, if the BSP application is stateful. In this case, the the normal ABAP OO constructor.

  • Call each time if the BSP page class is created in the stateless case.

The opposite of OnCreate is OnDestroy.

Integration

OnCreate is useful mainly in stateful applications, because in stateless mode, the page object is reinitialized every time the page is called. If you are working in stateful mode without an explicit navigation path, and if you run the page a second time (reuse the page), the page instance remains constant. OnCreate is not run the second time.

See also:

Features

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.