Event handler Creation in CRM Webclient UI
In CRM Webclient UI, we are using service application.
We have enhanced some fileds through eewb.
Few of them are dependent dropdowns. on change of one dropdown other dropdown values needs to be loaded.
To load the values dynamically, In the get_P_XYZ method of the field XYZ , i have raised an event DDLB_ONSELECT.
I am new to bsp applications. I want to generate event handler for this. I tried to create the event handler using the wizard. But i am getting the error - View not copied with wizard; processing not possible.
Please guide me how to create an event handler for the corresponding event or solve the error.
Carsten Kasper replied
when I have to deal with dependent values I normally do the following:
Raise a Server Side Event in GET_P method as you did
In the GET_V method I build up the value help and store it in a global variable on the context node. In the GET_V you have got access to the current entity with collection_wrapper->get_current() --> meaning you can always have the correct value of all the fields and read dependent on them.
In the implementation class create an event handler that clears the global variable for the dependent value help whenever a new value is selected in the leading field.
I suppose you have got a similar setup.
One possibility to circumvent your problem is to skip the step with the global variable. Just shoot the server side event. This leads to a server roundtrip and the valuehelp for the dependent field is calculated again, based on the updated value of the leading field.
However, this method is not very good for performance! Thus I would normally keep away from it.
Concerning your problem with the wizard. It is correct that you have to have the view created with the wizard to be able to use it later on. On copied views the wizard does some redefinitions of common methods and it does complain if they are not exactly as it expects them.
For event handlers I believe this should only be the DO_HANDLE_EVENT in the parent class of your IMPL. Meaning if you inherit from a SAP view inheritance is as follows: SAP class --> SAP class _IMPL --> Your class --> Your class _IMPL
The DO_HANDLE_EVENT would have to be in the Your class.
An easy way would be recreating the view using the wizard (be sure to restart the component workbench after this).
Another is create the event handler manually. Copy an existing EH_ONXXX method, and add a CASE statement into the DO_HANDLE_EVENT that calls this copied method.