on 12-29-2011 11:03 AM
Hi to everybody,
i have a little problem on SAP CRM WebUI.
I created a whole custom view inside factsheet page, component BP_FACTSHEET.
I have already filled inside method GET_P_* the following code :
WHEN if_bsp_wd_model_setter_getter=>fp_sortable.
rv_value = 'TRUE'.
but data is NOT being sorted by custom columns.
How can i solve this problem? Someone could you help me,please?
Thanks in advance.
Best regards.
Dario.
Hi Dario
Are the custom attributes that you have mentioned part of BOL?
You can find the procedure here.
[Sorting on custom fields|http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=237176002]
Regards
Leon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dario
In the event eh_onsort, you can add the following code
lv_attr_name = lv_thtmlb_tableview->column_key.
CHECK lv_attr_name IS NOT INITIAL.
* get sorting direction
CASE lv_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.
IF lv_attr_name EQ 'VALID_TO' OR lv_attr_name EQ 'VALID_FROM'.
gv_sort_field = lv_attr_name .
lv_attr_name = if_bol_col_sorting=>custom .
lr_sort_callback = me .
ELSE.
CLEAR gv_sort_field .
ENDIF.
* sort
TRY.
me->collection_wrapper->sort( iv_attr_name = lv_attr_name
iv_sort_order = lv_sort_order
iv_stable = lv_stable
iv_sort_callback = lr_sort_callback
).
CATCH cx_crm_cic_parameter_error.
* could be a renamed attribute or field which does not belong to the collection
ENDTRY.
And in the method IF_BOL_COL_SORTING~IS_A_GREATER_B, add the code
CASE gv_sort_field.
WHEN 'VALID_FROM' OR 'VALID_TO'.
rv_result = cl_crm_uiu_bp_tools=>is_date_a_greater_b(
iv_a = iv_a
iv_b = iv_b
ir_tv_node = me
iv_node_name = '//BUILPAYMENTCARD/'
iv_sort_field = gv_sort_field ).
ENDCASE .
where gv_sort_field is a global variable in the context node class.
Regards
Leon
my Method is very similar to Leon's
1. On sort Event
if lv_attr_name eq 'ELAPSEDTIME'.
me->typed_context->srvreq->collection_wrapper->sort(
iv_attr_name = if_bol_col_sorting=>custom
iv_sort_order = lv_sort_order
iv_stable = abap_false
iv_sort_callback = lr_callback ).
endif.
if for the specified column, call Custom sort
2. Add interface if_bol_col_sorting into the class
3. Implement if_bol_col_sorting~is_a_greater_b for custom-defined compare function
method if_bol_col_sorting~is_a_greater_b.
....
if me->gv_sort_field eq 'ELAPSEDTIME'.
lv_s1 = .....
lv_s2 = .......
if lv_s1 > lv_s2.
rv_result = abap_false.
else.
rv_result = abap_true.
endif.
endif.
...
endmethod.
Hopefully, It will help you out
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.