SAP Web Dynpro - Event & Actions

You can create events to enable communication between the controllers. You can allow one controller to trigger events in a different controller. All events that you create in the component controller are available in the component.

Inbound plugs can also act as an event, thus when you call a view using the inbound plug, an event handler is called first.

You can also use some special events like Button to link with the user actions.

Button element like pushbutton can react to a user interaction by clicking on the corresponding pushbutton that can trigger a handling method to be called in the view controller. These UI elements contain one or several general events, which can be linked with a specific action that executes at design time.

When an action is created, an event handler is created automatically. You can associate a UI element with different actions.

You can also reuse actions within a view by linking an action to several UI elements.

Example 1

An onAction event for the button click or onEnter event for the Input field, when the user presses the "Enter" key in the field.

OnAction Event

Actions can be created for any UI elements in Web Dynpro framework. To set an action, go to Properties tab → Event section.

You can also create Actions from the actions tab of the view controller. An Event handler is automatically created with naming convention onaction<actionname>

Example 2

Action name is SET_ATTRIBUTES and the event handler for an action would be ON_SET_ATTRIBUTES.

Event Example2