Subscribing to Events with Web Dynpro
Use
A Web Dynpro application can subscribe to an event using a MessageBasedTrigger UI element, an invisible element that listens for RTMF events.
With the MessageBasedTrigger , you specify the following information:
-
The name of the event to which you want to subscribe
-
The name of the Web Dynpro action to be triggered when the event is received
Procedure
-
Create the action to be triggered when the event is published.
If you want to get the message parameters for the event, add a WDMBTParameters parameter to the action.
-
Add a MessageBasedTrigger UI element to the view that is to receive the event.
-
For the MessageBasedTrigger , set the following properties:
-
eventName : The name of the event to which you want to subscribe
-
onAction : The name of the Web Dynpro action to be triggered when the event is received
-
-
If you added an action parameter to receive the RTMF event parameters, map the parameterMap parameter of the onAction event of the MessageBasedTrigger to the WDMBTParameters parameter that you added to the action.
Retrieving Parameters
If the message sent with an event contains custom parameters, these are passed into the Web Dynpro action that is triggered.
You can use the following methods on the WDMBTParameters object to retrieve parameter values:
-
params.getParameterKeys() : Returns a string array of parameter keys.
-
params.getSingleValue("ParameterName") : Returns the string value of a parameter that contains a single value.
-
getMultipleValues("ParameterName") : Returns a string array of values of a parameter that contains multiple values.