Tuesday, June 10, 2008

Hook Methods: Methods Called by the Runtime Web Dynpro ABAP

Along with the previously mentioned application methods, each local controller interface has a fixed number of methods that can only be called by the runtime. The application developer cannot specify when these methods are called, but can modify the implementation. The time when these methods are called is predefined. For a description, refer to the phase model of Web Dynpro.

WDDOINIT and WDDOEXIT

The simplest examples are the methods WDDOINIT and WDDOEXIT.

WDDOINIT is called automatically when a controller is initialized for the first time. For each newly created controller, these methods are empty but can be filled with source code. These methods can contain the following steps, for example:

Creating instances of help classes

Initializing controller attributes

If you need more attributes for the programming and these are also reference variables, they can be initialized here.

Triggering authorization checks (recommended for help classes)

Setting initial values of the controller context

Instantiation of used components (see Cross-Component Programming)

This graphic is explained in the accompanying text Example of the initialization of a controller context:

method WDDOINIT .

data: NODE type ref to IF_WD_CONTEXT_NODE,

FLIGHTS type SPFLI_TAB.

* get node from context

NODE = WD_CONTEXT->GET_CHILD_NODE( 'CARRIER_NODE' ).

* get connections from help class

FLIGHTS = CL_WD_GET_SPFLI=>GET_FLIGHTS( ).

NODE->BIND_ELEMENTS( FLIGHTS ).

endmethod.

WDDOEXIT is called by the runtime when exiting the controller and can be used for releasing locks, for example.

Depending on the value of the controller the local controller interface also has the following hook methods available:

Component controller

view:controller

Window controller

WDDOINIT / WDDOEXIT

WDDOINIT / WDDOEXIT

WDDOINIT / WDDOEXIT

WDDOAPPLICATIONSTATECHANGE

WDDOBEFOREACTION


WDDOBEFORENAVIGATION

WDDOAFTERACTION

WDDOONOPEN

WDDOPOSTPROCESSING

WDDOMODIFYVIEW

WDDOONCLOSE

No comments:

Archive