1. Add Reason field to the Search View Add a new entry to the BOL structure CRMST_QUERY_ACT_BTILusing the 'Append Structure' option, as shown below. This will add our custom field Reason to the search parameter list. Then add it to the Account Search view configuration
2.To make the reason filed a Drop Down, create a new method GET_V_ZREASON in the class ZL_BT126S_A_APPTSQ_IMPL.
This method includes the logic to default the Reason filed drop down values if no Process Type is selected. If a process type is selected the Reason drop down values are populated accordingly. According to the Process Type selected, retrieve the Subject Profile and then using the function module 'CRM_SUBJECT_PROF_CODES_PROVIDE' get the drop down values.
3. To trigger a Server Round trip when a drop down value is selected, enhance the method GET_DQUERY_DEFINITIONS, of the implementation class ZL_BT126S_A_APPTSQ_IMPL. Include the highlighted line of code as shown below.
<rt_result>-server_event = 'DDLB_CLICK'.
3.Add Reason field to the Result View Enhance the view BT126S_APPT/ApptSR of the component BT126S_APPT. Create a new attribute 'ZREASON' to the context node BTQRACT using the wizard as shown below.
Generate the Getter and Setter method by right clicking on the attribute.
Now implement the GET_ZREASON method as shown below.
4. Implement search using Reason field with the BADI Go to se18 BADi : CRM_BADI_RF_Q1O_SEARCH
Create an implementation for the BADI
Add the filter value . This value would be the context node for which we need to enhance the search. BTQACT = OBJ_IL
Implement the IF_CRM_RF_Q1O_SEARCH~SEARCH method of the BADi for the search logic.
Activate the BADI.
Now you are done and the search should work.