An event handler method responds to actions or to events. We have used this type of methods every time we have assigned an action to an UI element.This kind of methods are special methods of a view controller that has the prefix ONACTION followed by the action name.As we have seen,the action is defined in the Action tab and the corresponding event handler method is generated by the Framework.
Action and event handler method
We can assign an action to an UI element that has an event, indifferent if this UI element is created dynamically or at the design time.
Action and UI element
Let’s create an example where we use an event handler method implemented to respond to events of inbound plugs!
We have seen that the outbound plugs are the starting point of navigation, called in any method of the view controller by using the statement:
This method allows also parameter transfer
wd_this->FIRE_<NAME_OUTBOUND>_PLG(PARAMETER = ‘value’).
In this case, the PARAMETER has to be entered in the parameter table of the view controller.For a better understanding,we create the same example as for the fire methods, but in this case we show an error message when the user doesn’t enter a value in the inputField UI element.We will pass a reference to Message Manager from a view to another view, via an outbound parameter.In the View_1 we add in the parameter table,on the Outbound plug,a parameter named P_MM.
Defining the parameter for an Outbound Plug
When the user presses the Next button, the Framework triggers the event handler method onactionnext.
Event handler method
We don’t have the possibility to create a parameter for an Inbound Plug.In this case, we use the event handler method HANDLEIP_V_VIEW2 to read the value of the P_MM parameter.
When an inbound plug is called, the handler method that is uniquely assigned to this inbound plug is called. This method is automatically generated in the view controller when the inbound plug is created.We find this method in the Methods tab of the view V_VIEW2.
Event handler method
The value of the parameter P_MM is passed by the outbound plug OP_TO_V_VIEW2. To be able to read the value of this parameter, we have to add the parameter P_MM to the signature of the event handler method assigned to the inbound plug,i.e.the HANDLEIP_V_VIEW2 event handler method.
Event handler method. Implementation
In this way, the value of the P_MM parameter is known by the event handler method and can be used to send a message in case the user doesn’t enter a value in the InputField UI element.
SAP ABAP Web Dynpro Related Tutorials
|SAP ABAP Tutorial|
SAP ABAP Web Dynpro Related Interview Questions
|SAP ABAP Interview Questions||SAP ABAP Web Dynpro Interview Questions|
|Sap Abap Hr Interview Questions||SAP ABAP Dictionary Interview Questions|
|SAP ABAP Enhancement Interview Questions||SAP ABAP Module Pool Interview Questions|
|SAP ABAP Report Developer Interview Questions||SAP ABAP Data Dictionary Interview Questions|
|SAP ABAP ALV Reports Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.