Start of Content Area

Process documentation Event Handling  Locate the document in its SAP Library structure

Overview

In general, events are situations or incidents that can be recognized by the application and cause corresponding reactions within the application.

Events occur during the interaction between the user and the UI element. Web Dynpro provides specific events for several UI elements. You can assign specific properties to the UI elements that affect the display of the UI elements and by implementing event handling code you can also specify the reaction to an event triggered by an interaction between the user and the UI element. In the Web application, the interaction results in a request sent to the server by the browser. The Web Dynpro Framework analyses the event and calls the corresponding source code in the controller – that is, the event handler. Event handlers are functions that are executed when an event occurs.

Definition

In Web Dynpro, events are called actions if they are sent from the client to the server. A typical event of this type is selecting a button. Actions are also the selection of an entry in a dropdown list box (onSelect action) and the toggling to a checkbox (onToggle action).

The code of the event handling, known as Action Event Handler in Web Dynpro, is implemented in the view controller.

Note

The controller interface provides methods that allow access to every action defined in the controller. The wdGetActionNameAction() method (for example, wdGetSaveAction()) returns the corresponding action instance. In addition, the controller interface lists all actions that are defined for a controller. The listing is displayed as an internal class within the controller interface. The class name is IPrivateControllerName.WDActionEventHandler. It contains a constant value with the names of all actions defined for the controller - for example, the Save action.

A controller with only one action named Save would contain the following action listing:

/** List of all available action event handlers */

   public final class WDActionEventHandler extends ActionEventHandlerEnum

   {

    public static final WDActionEventHandler SAVE =

         new WDActionEventHandler("onActionSave", true);

 

     private WDActionEventHandler(String value, boolean isValidating) {

      super(value, isValidating);

     }

   }

Note

The controller can deactivate an action named MyAction and consequently a UI element that triggers a specific action using the following code sequence:

  

wdThis.wdGetMyAction().setEnabled(false);

...

An action event handler is declared when creating an action at design time. You can then bind the action to a UI element or UI element event. The action is executed when an event occurs that was triggered by a specific UI element.

For more information about event handling within a Web Dynpro application, refer to

¡        Creating an Action at Design Time

¡        Web Dynpro Action at Runtime – Interface IWDAction

¡        Event Parameter and Parameter Mapping

.

  

  

 

End of Content Area