Skip to Content
0
Former Member
Nov 22, 2012 at 04:29 PM

Column not sortable

71 Views

Hello,

In view BTDOCFLOW/HdrDocFlowOV I have added two new attributes to context node BTDocFlow.

I have entered to below mentionned coding in

GET_P

EH_ONSORT

IS_A_GREATER_B

but still I don't have the option to sort, when I click on the column-header.

Best regards,

Thomas Wagner

method get_p_zz_valid_from.



case iv_property.

when if_bsp_wd_model_setter_getter=>fp_sortable.

rv_value = 'TRUE'.

endcase.



endmethod.

method eh_on_sort.



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.



break-point.



try.

lr_thtmlb_tableview ?= iv_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

if lr_thtmlb_tableview->column_key = 'ZZ_VALID_FROM' or

lr_thtmlb_tableview->column_key = 'ZZ_VALID_TO'.



gv_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->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 = me ).



catch cx_crm_cic_parameter_error.
* could be a renamed attribute or field which does not belong to the collection

endtry.

return.



else.

call method super->eh_on_sort

exporting

iv_htmlb_event = iv_htmlb_event

iv_htmlb_event_ex = iv_htmlb_event_ex.

endif.



endif.



endmethod.

method if_bol_col_sorting~is_a_greater_b.



case gv_sorting_attribute.

when 'ZZ_VALID_FROM'.

rv_result = is_a_greater_b_date( iv_a = iv_a iv_b = iv_b ).

when 'ZZ_VALID_TO'.

rv_result = is_a_greater_b_date( iv_a = iv_a iv_b = iv_b ).

when others.

call method super->if_bol_col_sorting~is_a_greater_b

exporting

iv_a = iv_a

iv_b = iv_b

receiving

rv_result = rv_result.

endcase.



endmethod.