Hello,
We have custom field in "Opportunities" search result.
So far I have added below code in Method GET_P_ZZFIELD:
method GET_P_ZZPUNKTE. case iv_property. when if_bsp_wd_model_setter_getter=>fp_sortable. rv_value = 'TRUE'. endcase. endmethod.
and redefined EH_ONSORT:
method EH_ONSORT. data: lr_bo type ref to if_bol_bo_property_access, lr_thtmlb_tableview type ref to cl_thtmlb_table_view, lv_attr_name type name_komp, lv_sort_order type char1, lv_stable type abap_bool value abap_false, lv_sort_field type string, lo_sort TYPE REF TO if_bol_col_sorting. try. lr_thtmlb_tableview ?= htmlb_event_ex. catch cx_sy_move_cast_error. exit. endtry. if lr_thtmlb_tableview is bound. * check whether its realy a sorting event check lr_thtmlb_tableview->event_type = cl_thtmlb_table_view=>co_header_click. * get name of column to be sorted lv_attr_name = lr_thtmlb_tableview->column_key. if lr_thtmlb_tableview->column_key = 'ZZFIELD'. lv_sort_field = lr_thtmlb_tableview->column_key. * get sorting direction case lr_thtmlb_tableview->column_sort_direction. when 'U'. lv_sort_order = cl_bsp_wd_collection_wrapper=>sort_ascending. when 'D'. lv_sort_order = cl_bsp_wd_collection_wrapper=>sort_descending. when others. return. endcase. * sort try. me->typed_context->RESULT->collection_wrapper->sort( iv_attr_name = if_bol_col_sorting=>custom iv_sort_order = lv_sort_order iv_stable = lv_stable iv_use_text_relation = lv_stable * iv_sort_callback = lo_sort ). catch cx_crm_cic_parameter_error. endtry. return. else. CALL METHOD SUPER->EH_ONSORT EXPORTING HTMLB_EVENT = HTMLB_EVENT HTMLB_EVENT_EX = HTMLB_EVENT_EX. endif. endif. endmethod.
Now on search result table field I have options "Search Ascending" and "Search Descending" but it doesn`t work.
Could you tell me what am I doing wrong?
Would appreciate your help.