Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to give sorting functionality for table control columns

Former Member
0 Likes
613

hi,

i've table control with 10 columns. Now i want sorting functionality for every column.

Regards,

jack.

2 REPLIES 2
Read only

Former Member
0 Likes
555

Hi Jack,

Have you checked this thread ?

Regards.

Read only

former_member202818
Active Contributor
0 Likes
555

Hi Jack,

To get the selected column, pls refer the snap,

Here TBC_EDIT is my table control. I have 14 columns and i selected the 14th column.

Now you keep a button in screen for sorting. on click on sort button check which column is selected.

and sort your internal table based on this column.

WHEN 'SORT_UP'.

       READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.

       IF sy-subrc = 0.

         SORT itab STABLE BY (cols-screen-name+10) ASCENDING.

         cols-selected = ' '.

         MODIFY flights-cols FROM cols INDEX sy-tabix.

       ENDIF.

Note : if u go for ALV it will be better..

Regards

Sreekanth