on 03-19-2015 5:21 AM
Hi team,
I wanto to sort ageing in days field ,in ascending order.i have created this field through AET, and i have implemented on Get method. i have added in service order result screen.So could you please help here how to sort ascending order.
Now the ageing in days values are coming like as below.
500
10
524
535
100
34
but i want all the values in acending order how to do it..and could you please help any code?
Thanks
kalpana
Algorithm area is more suitable for your issue.
Considering the performance I suggest you use Quicksort algorithm.
See the link for reference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Webster,
Thanks for your reply..
See i have added the logic on SORT method as below..
METHOD sort
.
CALL METHOD super->sort
.
DATA: lv_thtmlb_tableview TYPE REF TO cl_thtmlb_table_view,
lr_cn TYPE REF TO cl_bsp_wd_context_node_tv,
lv_event TYPE REF TO cl_htmlb_event_tableview.
DATA : lv_sort_order TYPE char1,
lv_sort_callback TYPE REF TO if_bol_col_sorting,
lv_stable TYPE abap_bool,
lv_attr_name TYPE name_komp.
IF gv_sort_column IS NOT INITIAL AND gv_sort_direction IS NOT INITIAL.
* get sorting direction
TRY .
lv_attr_name = gv_sort_column."'AET FIELD
lv_sort_order = gv_sort_direction.
lv_sort_callback = me.
*
me->typed_context->btqrsrvord->collection_wrapper->sort(
EXPORTING
iv_attr_name = lv_attr_name " Component Name
iv_sort_order = lv_sort_order " Sort Sequence
iv_stable = abap_true " Flag: Stable Sorting
iv_sort_callback = lv_sort_callback " Callback Interface for Applic.-Controlled Collection Sorting
).
CATCH cx_crm_cic_parameter_error.
ENDTRY.
ENDIF.
And GET_P method
METHOD
get_p_/rcrm/f004b.
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_sortable.
rv_value = 'TRUE'.
ENDCASE.
ENDMETHOD
.
In do_prepare_out put method
method DO_PREPARE_OUTPUT.
*if iv_first_time = abap_true.
*CALL METHOD SUPER->DO_PREPARE_OUTPUT
* EXPORTING
* iv_first_time = iv_first_time.
** .
*else.
prepare_toolbar( ).
sort( ).
*endif.
endmethod.
But still it is not working ...Could you please suggeset where i need to do change..
Thanks
kalpana
Hi Kasi,
I have tried already ..but still is doesnt work ,idid changes in code as below please help..i want to descending order in that custom field,in service order ,service request,complaint screen..
So ihave addded code in SORT method as below./This is AET field na,just i have displayed the value in result.but data is n ot saved in ATADMINH..please check my code
SORT Method
METHOD sort
.
CALL METHOD super->sort.
** .
DATA: lv_thtmlb_tableview TYPE REF TO cl_thtmlb_table_view,
lr_cn TYPE REF TO cl_bsp_wd_context_node_tv,
lv_event TYPE REF TO cl_htmlb_event_tableview.
DATA : lv_sort_order TYPE char1,
lv_sort_callback TYPE REF TO if_bol_col_sorting,
lv_stable TYPE abap_bool,
lv_attr_name TYPE name_komp.
IF gv_sort_column IS NOT INITIAL AND gv_sort_direction IS NOT INITIAL.
* get sorting direction
TRY .
lv_attr_name = gv_sort_column.
lv_sort_order = gv_sort_direction.
lv_sort_callback = me.
*
me->typed_context->btqrsrvord->collection_wrapper->sort(
EXPORTING
iv_attr_name = lv_attr_name " Component Name
iv_sort_order = lv_sort_order " Sort Sequence
iv_stable = abap_true " Flag: Stable Sorting
iv_sort_callback = lv_sort_callback " Callback Interface for Applic.-Controlled Collection Sorting
).
CATCH cx_crm_cic_parameter_error.
ENDTRY.
ENDIF.
**
---------------------------------------
DO_PREAPRE_OUTPUT
gv_sort_direction
= 'D'.
gv_sort_column = '/RCRM/F004B'.
sort( ).
-----------------------------------------------
but still it doesnt work..
Please guide me.
Thanks
Kalpana
Hi Kalpana,
Please keep a break point in EH_ONSORT event and then click on sort ascending or descending in your ageing attribute in web ui. You can cross check the attribute name gv_sort_column = lv_thtmlb_tableview->column_key.
One more important thing, once you are called sort method in do prepare out. add below code
btqrsrvord->build_table( ). method.
Best Regards,
Dharmakasi.
Hi kasi,
i have checked in run tume in line -gv_sort_column = lv_thtmlb_tableview->column_key ,iam getting Attribute name.
i have added the logic in do_prepare_output
CALL METHOD super->do_prepare_output.
* DATA : lr_ref TYPE REF TO /rcrm/16s_s_advancedsrl_impl.
* CREATE OBJECT lr_ref.
gv_sort_direction = 'D'.
gv_sort_column = '/RCRM/F004B'.
sort( ).
BTQRSRVORD->build_table( ).
Here iam getting BTQRSRVORD is uknown.
Thanks
Kalpana
Hi Kalpana,
Check in super class do_prepare_output, how they are calling build_table method in standard code.
You can try by giving typed_context->BTQRSrvOrd->build_table after sorting is done.
You have to follow the same procedure. Once you have done the sort on result list you have to call the build table. So that system will display the sorted result list in web ui.
Best Regards,
Dharmakasi.
Hi Kasi,
Thanks for your reply .i have added the code in do_prepare_output method as like as below.
CALL METHOD
super->do_prepare_output.
* DATA : lr_ref TYPE REF TO /rcrm/16s_s_advancedsrl_impl.
* CREATE OBJECT lr_ref.
gv_sort_direction = 'D'.
gv_sort_column = '/RCRM/F004B'.
sort( ).
gr_result_list_cnode->build_table
( ).
Now Result should be displayed like as below.Descending order is not works properly..but ascending order is working fine..descending order check the scren shot below.could you please help here.
Thanks
Kalpana
Hi Kasi,
Thanks for your reply..SORT method code is as below..
METHOD sort
.
CALL METHOD super->sort.
DATA: lv_thtmlb_tableview TYPE REF TO cl_thtmlb_table_view,
lr_cn TYPE REF TO cl_bsp_wd_context_node_tv,
lv_event TYPE REF TO cl_htmlb_event_tableview.
DATA : lv_sort_order TYPE char1,
lv_sort_callback TYPE REF TO if_bol_col_sorting,
lv_stable TYPE abap_bool,
lv_attr_name TYPE name_komp.
IF gv_sort_column IS NOT INITIAL AND gv_sort_direction IS NOT INITIAL.
* get sorting direction
TRY .
lv_attr_name = gv_sort_column.
lv_sort_order = gv_sort_direction.
lv_sort_callback = me.
*
me->typed_context->btqrsrvord->collection_wrapper->sort(
EXPORTING
iv_attr_name = lv_attr_name " Component Name
iv_sort_order = lv_sort_order " Sort Sequence
iv_stable = abap_true " Flag: Stable Sorting
iv_sort_callback = lv_sort_callback " Callback Interface for Applic.-Controlled Collection Sorting
).
CATCH cx_crm_cic_parameter_error.
ENDTRY.
ENDIF.
ENDMETHOD
.
Thanks
Kalpana
Hi Kalpana,
Instead of the below code
me->typed_context->btqrsrvord->collection_wrapper->sort(
EXPORTING
iv_attr_name = lv_attr_name " Component Name
iv_sort_order = lv_sort_order " Sort Sequence
iv_stable = abap_true " Flag: Stable Sorting
iv_sort_callback = lv_sort_callback " Callback Interface for Applic.-Controlled Collection Sorting
).
Add the below code
gr_result_list_cnode->collection_wrapper->sort( iv_attr_name = gv_sort_column
iv_sort_order = gv_sort_direction
iv_stable = abap_true ).
Best Regards,
Dharmakasi.
Hi Kalpana,
What code you have added in sort method?
Can you send me the code in sort method, i have informed in my earlier post
Add the below code
gr_result_list_cnode->collection_wrapper->sort( iv_attr_name = gv_sort_column
iv_sort_order = gv_sort_direction
iv_stable = abap_true ).
did you add this instead of your existing code?
You can keep break point inside sort method and see what values are coming in gv_sort_column and gv_sort_direction values.
Best Regards,
Dharmakasi.
Hi Kasi,
i have added the below code in SORT method..in debugging iam getting values in debuging .but still values are not displayed in proper descending order in result screen ..please help .
METHOD sort
.
CALL METHOD super->sort.
DATA: lv_thtmlb_tableview TYPE REF TO cl_thtmlb_table_view,
lr_cn TYPE REF TO cl_bsp_wd_context_node_tv,
lv_event TYPE REF TO cl_htmlb_event_tableview.
DATA : lv_sort_order TYPE char1,
lv_sort_callback TYPE REF TO if_bol_col_sorting,
lv_stable TYPE abap_bool,
lv_attr_name TYPE name_komp.
IF gv_sort_column IS NOT INITIAL AND gv_sort_direction IS NOT INITIAL.
* get sorting direction
TRY .
lv_attr_name = gv_sort_column."'/RCRM/F004B'.
lv_sort_order = gv_sort_direction.
gr_result_list_cnode->collection_wrapper->sort( iv_attr_name = gv_sort_column
iv_sort_order = gv_sort_direction
iv_stable = abap_true
iv_sort_callback = lv_sort_callback ).
* ).
CATCH cx_crm_cic_parameter_error.
ENDTRY.
ENDIF.
ENDMETHOD
.
Hi kasi,
I have commented the code in DO_PREAPRE_OUTPUT..i have clicked Descending order in result list ,it is not working..if we click Ascending order then it is working fine..Descending order is not working ..What changes we need to do..please help
And i want to do same functionality in service request screen.
component - SRQM_INCIDENT_S
VIew - SRQM_INCIDENT_S/IncidentSRL
Thanks
Kalpana
Hi kasi,
i have checked in result of service order ,and commented on code DO_PREPARE_OUTPUT,if we click descending order in result list its getting ascending order in correct format.see below image.
.if we click again descending order it is coming as below..Ascending order functionality doesnt work.plesae help here.
i want to do same changes in service request component also.
component - SRQM_INCIDENT_S
VIew - SRQM_INCIDENT_S/IncidentSRL
Thanks
kalpana
Hi Kalpana,
I hope there is already sort code in standard do_prepare_output itself. I checked in my system i can see the below code in do_prepare_output standard code.
prepare_toolbar( ).
sort( ).
gr_result_list_cnode->build_table( ).
If you have the same code in your standard do_prepare_output, just remove all your custom changes in sort method and do_prepare_output method.
Then pass the gv_sort_column with your custom field name and gv_sort_order with 'D' and then call the super class do_prepare_output.
gv_sort_column = 'Field name'
gv_sore_order = 'D'.
Call Super 'DO_PREPARE_OUTPUT'
iv_first_time = iv_first_time.
Best Regards,
Dharmakasi.
HI kasi,
i have commented code in SORT method and in do_prepare_outpu method i have add code as below...but stil it does not work...and how to do it complaint screen ..same process we need to implement in complaint screen as well..
METHOD
do_prepare_output.
CALL METHOD SUPER->DO_PREPARE_OUTPUT
EXPORTING
iv_first_time = iv_first_time. "ABAP_FALSE
gv_sort_direction = 'D'.
gv_sort_column = '/RCRM/F004B'.
ENDMETHOD
.
Thanks
kalpana
Hi Kasi,
bt120s_cpl
BT120S_CPL/AdvSearchComplRL
i want to do changes in sorting in reuslt screen.how to do it.could you please help here.here i have added the logic on sort method and do_prepare_output method
METHOD sort
.
CALL METHOD super->sort.
DATA: lv_thtmlb_tableview TYPE REF TO cl_thtmlb_table_view,
lr_cn TYPE REF TO cl_bsp_wd_context_node_tv,
lv_event TYPE REF TO cl_htmlb_event_tableview.
DATA : lv_sort_order TYPE char1,
lv_sort_callback TYPE REF TO if_bol_col_sorting,
lv_stable TYPE abap_bool,
lv_attr_name TYPE name_komp.
IF gv_sort_column IS NOT INITIAL AND gv_sort_direction IS NOT INITIAL.
* get sorting direction
TRY .
lv_attr_name = gv_sort_column.
lv_sort_order = gv_sort_direction.
* lv_sort_callback = me.
me->typed_context->RESULT->collection_wrapper->sort(
EXPORTING
iv_attr_name = lv_attr_name " Component Name
iv_sort_order = lv_sort_order " Sort Sequence
iv_stable = abap_true " Flag: Stable Sorting
iv_sort_callback = lv_sort_callback " Callback Interface for Applic.-Controlled Collection Sorting
).
*
* gr_result_list_cnode->collection_wrapper->sort( iv_attr_name = gv_sort_column
* iv_sort_order = gv_sort_direction
* iv_stable = abap_true ).
* ENDIF.
* CATCH cx_root.
* " return as it is just sorting.
* RETURN.
ENDTRY.
* ENDTRY.
ENDIF.
ENDMETHOD
.
--------------------
Do_prepare_output method
super
->do_prepare_output( ).
*
* DATA: lr_tcc TYPE REF TO cl_bt120s_c_bspwdcomponen_impl.
**
* lr_tcc ?= me->comp_controller.
*
* me->typed_context->result->gv_value_help_mode = lr_tcc->gv_value_help_mode.
gv_sort_direction = 'D'.
gv_sort_column = '/RCRM/F004B'.
me->typed_context->result->build_table( ).
sort( ).
Thanks
kalpana
Hi Kalpana,
Can you please completely whatevet i suggested in my earlier post and follow it. I asked you to check in standard do_prepare_output method. If the standard method itself has code for sort, you can make use of the standard code itself. I asked you to set gv_sort_direction and gv_sort_column values before calling the super class do_prepare_output.
You can follow the same procedure as your doing it for service orders or service requests.
Best Regards,
Dharmakasi.
Hi Kasi,
I have tried what ever u suggested in earlier post..in standard do_prepare_output code is available.in sort method i have commented and in do_prepare_output method i have added the logic as below.
METHOD
do_prepare_output.
*CALL METHOD SUPER->DO_PREPARE_OUTPUT
* EXPORTING
* iv_first_time = ABAP_FALSE.
* super->do_prepare_output( ).
gv_sort_direction = 'D'.
gv_sort_column = '/RCRM/F004B'.
super->do_prepare_output( ).
ENDMETHOD
.
But still it doesnt work..
Thanks
kalpana
if field is part of result list, why can not you use filter property to sort it.
or if you want your result list always be sorted based on ageing, then you can do that in the do prepare output method of your view implementation class by sorting the collection based on your required field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
1 | |
1 | |
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.