Show TOC

Controller MethodsLocate this document in the navigation structure

Use

You can create methods for all controller types. To do this, choose the Methods tab page.

Caution

You should always call methods with the reference variable WD_THIS .

Determine the type of the method using the Method Type column.

  • Method

    Individual functions of the processing logic can be capsulated and be used again within the Controller Visibility .

  • Event Handler

    Event handlers react to events that were triggered by other controllers, and also to actions and inbound plugs of the same view. To be able to react to an external controller, a usage must first have been declared for the external controller.

  • Supply function

    A method of type Supply Function is always called the first time a controller is called, and is used to provide the controller context with initial data.

Some methods are created automatically when a controller is created (see also The Methods of the Local Controller Interface in the programming manual).

All controllers have the following two methods:

  • WDDOEXIT

    Cleanup method of the controller. This method is called automatically when a controller is exited. In the case of the component controller, this method has an optional importing parameter ( REASON) through which the reason for exiting the component can be passed. This parameter is only filled when there is a session timeout. If the component is exited regularly, that is, using an exit plug, then the parameter is initial.

  • WDDOINIT

    Initialization method of the controller This is processed automatically when the controller is first called.

The component controller is also equipped with the following methods:

  • WDDOBEFORENAVIGATION

    Error handling before the navigation through the application.

  • WDDOPOSTPROCESSING

    Handling of errors that occurred during the context validation.

A view controller automatically receives method WDDOMODIFYVIEW. This is a method to modify the view before rendering. This is the only method in which dynamically modifying the UI controls is permitted. The reference to the view and the information whether this view is displayed for the first time are passed to the method.

All methods are created and can be programmed accordingly if necessary. They are all called at a defined point (see Phase Model ).

Visibility of Methods and Embedding a Method in the Interface of a Component

The visibility of methods usually extends to the visibility framework of the entire controller. The visibility of methods of the component controller can, however, be extended beyond the limits of one's own component. If you want to make a method of a component controller available to the component interface, select the relevant checkbox in the Interface column. The Interface column is only displayed by the controller editor if you are editing a component controller.

Parameters of Methods

  • Individual methods can have any mandatory and optional parameters. Exactly one return parameter with arbitrary names is permitted.

  • Event handlers that react to a controller event always inherit the parameters of this event. If the parameters of an event were subsequently changed, the parameters of the event handler method can be updated using the Compare parameters function.

    If, on the other hand, an event handler reacts to an inbound plug, individual mandatory and optional parameters can be defined.

    Event handlers of actions always have the import parameter WD_EVENT of type CL_WD_CUSTOM_EVENT .

  • Like WDDOINIT, the parameters of predefined methods are similarly defined like the parameters of the supply functions.

Note

For individual methods you can specify class-based exceptions on the interface.