Application Development 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: 

How to give sorting functionality for table control columns

Former Member
0 Kudos

hi,

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

Regards,

jack.

2 REPLIES 2

iaki_vila
Active Contributor
0 Kudos

Hi Jack,

Have you checked this thread ?

Regards.

former_member202818
Active Contributor
0 Kudos

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