on 12-15-2008 4:03 PM
I have an alv table.
This is sorted ascending by the first column called "first" . I want to sort it descending by first colum.
How can I do that?
Thanks for help!!
Hi Ezachiael,
You need to use the create_sort_rule method of if_salv_wd_sort for achieving this sorting functionality. Refer to the code snippet below which am using inside the WDDOINIT method to sort the SEATSOCC field by descending order.
Regards,
Uday
METHOD wddoinit .
* Create component usage for alv component
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
* Get config model
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA: l_value TYPE REF TO cl_salv_wd_config_table.
l_value = l_ref_interfacecontroller->get_model( ).
* set visible row count
l_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).
* Sort rows by seatsocc descending
DATA: lr_field TYPE REF TO cl_salv_wd_field.
lr_field = l_value->if_salv_wd_field_settings~get_field( 'SEATSOCC' ).
lr_field->if_salv_wd_sort~create_sort_rule( sort_order =
if_salv_wd_c_sort=>sort_order_descending ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi check out this link
go to pg no 233 u'll find sorting methods
thanks and regards
Reeha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ezachiael,
Please check this link:
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.