Edwin van den Meijdenberg
Read all my blogsImplement an event handler in a CRM webclient search view
As a CRM webclient developer it is very common to implement search views. A user would be able to specify his search criteria and search for relevant objects.
- Other search parameters to appear or disappear
- Other dropdown listboxes to change their possible values
- Inform the user with a certain message
In a normal overview page, you could define the event in the P-getter. Unfortunately, the P-getter method in a search view does not allow you to set an event for the dropdown listbox, so you are not able to do such things. But there is an alternative.
Create an event handler for the search parameter
In the controller class of the searchquery view, method GET_DQUERY_DEFINITIONS is used to retrieve search field information. This method allows you to change the server event for search fields. Redefine this method and change the server event setting for the search parameter.
METHOD get_dquery_definitions.
FIELD-SYMBOLS:
<lfs_field_info> TYPE crms_thtmlb_search_field_info.
CALL METHOD super->get_dquery_definitions
RECEIVING
rt_result = rt_result.
READ TABLE rt_result ASSIGNING <lfs_field_info> WITH KEY field = ‘ITM_TYPE’.
IF sy-subrc = 0.
<lfs_field_info>-server_event = ‘ITM_TYPE_CHANGED’. “Just used for roundtrip!
ENDIF.
ENDMETHOD.
You could then either create the event handler to implement your specific logic, or just use a dummy event, simply to trigger a roundtrip.
One response to “Implement an event handler in a CRM webclient search view”
thanks for sharing