Show TOC

Creating ActionsLocate this document in the navigation structure

Use

You need actions to implement an event handler. An action is a special method for handling events. To assign an action to a UI element, you must create the action in the SAP NetWeaver Developer Studio, bind it to the UI element, and manually implement the event handler in the controller for the corresponding view.

Validating Action

If you enter any invalid data, this inhibits the execution of the event handler and leads to an error message being displayed for the user. After correcting the invalid data, the user can press the button again. The Web Dynpro runtime framework automates this behavior ( generic validation service ). If the end user enters invalid data, execution of the event handler is blocked.

Non-validating action

A non-validating action is always executed, regardless of whether or not the end user entered invalid data. The event handler must be prepared to deal with invalid data. It is advisable to reinitialize invalid context attributes as soon as they are no longer required. Otherwise, any subsequent validating actions could be prevented by old validation errors.

Non-validating actions are used when the user quits an application, as the user would otherwise remain in the application if the entries are invalid. You can also use it to reset the entries in all fields of a view at runtime.

Procedure
  1. Select the UI element in the Outline view and select the event in the Properties view.

  2. To start the NewAction wizard, select the Create button.

    Note

    You can also start the New Action wizard in the Action tab by choosing New below the Action table .

    The Web Dynpro generator automatically creates the event handler. If you assigned the name Save to the action, the corresponding event handler is onActionSave.

Result

You have defined an action and the corresponding event handler.

public voidon ActionSave(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent)

{

//@@begin onActionSave(ServerEvent)

//@@end

}

More Information

Mapping Event Parameters to Action Parameters

Mapping the Generic Event Parameter nodeElement

Implementing Parameter Mapping