WD_THIS Reference Variable and the Local Controller InterfaceLocate this document in the navigation structure

Use

Each controller contains a local interface that can be accessed in the controller.

The WD_THIS controller attribute is a reference to this local interface. Depending on the controller, a reference variable is of the following type:

  • IF_COMPONENTCONTROLLER

  • IF_<MY_CUSTOM_CONTROLLER>

  • IF_<MY_VIEW>

  • IF_<MY_WINDOW>

The methods and attribute of the local controller interfaces can be accessed using these reference variables. This includes:

  • All self-defined methods that have been created and implemented by an application developer for the current controller.

    Since the application developer can change the implementation, these methods are listed on the Methods tab page of the controller editor. You switch to the ABAP editor for adding source code by double-clicking the method name. More information: Methods of the Local Controller Interface

  • The application developer can call another group of methods but cannot change the implementation of these predefined methods .

    Note

    For general information on different interface types and their visibility within one or more Web Dynpro components, see Controllers of a Web Dynpro Component .

  • The application developer can implement a third group of methods, but these methods are exclusively called by the runtime .

  • All attributes of the controller are accessed using the reference variable WD_THIS.

    Caution

    Always call methods using WD_THIS and never using ME. Otherwise, the pre and post exit methods do not run.

Accessing the Web Dynpro Runtime API

The generated interface of a controller (local and global) contains a restricted number of methods. It only contains methods and attributes that can directly or indirectly be defined or implemented by the application developer. Therefore, the Web Dynpro runtime provides a generic runtime API for each controller type. In this API, several frequently used methods are implemented and can be used by the application developer. You can access general functions like the portal manager or message manager of the framework using these interfaces. The WD_GET_API method, which is contained in all generic controller interfaces, allows access to the corresponding runtime API.

WD_COMP_CONTROLLER Attribute of the View Controller

In most cases, it is useful to declare the usage of the component controller for a view controller. The development environment has therefore predefined this step. In addition, each view controller already contains the WD_COMP_CONTROLLER attribute, which is a reference variable of the type IG_COMPONENTCONTROLLER. In each view controller, you can use the WD_COMP_CONTROLLER attribute to access all publicly accessible methods of the component-global generated interface of the corresponding component controller.