‎2018 Dec 06 11:24 AM
in my inetrnal table there is a field bwart(valuation type) in that there is four types
1)bought_out
2)inhouse 3)inter.plt 4)subcount
i want to sort like this -
1)inhouse
2)bought_out
3)inter.plt
4)subcount
please help....
‎2018 Dec 06 12:12 PM
Another option is to add an extra field to your internal table that you fill according to the bwart field and use that to sort instead.
‎2018 Dec 06 11:53 AM
You have to develop your own logic to obtain it, since there is not built-in function you can use: sorting works alphanumeric.
A rough approach
set_sort( USING it_origin = your_internal_table
i_value = 'inhouse'
changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value = 'bought_out'
changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value = 'inter.plt'
changing out_tab = final_table ).
set_sort( USING it_origin = your_internal_table
i_value = 'subcount'
changing out_tab = final_table ).
your_internal_table = final_table. "you can avoid it if you use final_Table
.....
.....
METHOD set_sort.
LOOP AT it_origin INTO DATA(orign) WHERE bwart = i_value.
APPEND origin TO out_tab.
ENDLOOP.
ENDMETHOD.
‎2018 Dec 06 12:12 PM
Another option is to add an extra field to your internal table that you fill according to the bwart field and use that to sort instead.
‎2018 Dec 06 3:43 PM
Arthur's is the easiest, but if you're a dedicated masochist, you could just implement the QuickSort algorithm - widely available on the internet.