Skip to Content
0
Mar 28, 2007 at 10:49 AM

Sorting a internal table with different keys

15 Views

Hi,

I have a internal table called itab, which has to be sorted with different keys. The priorities of the keys is decided at the runtime.

Consider the below statement where industry, term, amt are fields of the itab:

<b>SORT itab BY industry DESCENDING term DESCENDING amt DESCENDING.</b>

Here the itab is sorted with highest priority as industry, followed by term, followed by amt.

But now the requirement is that this priority might change. I will have three variables deciding the priority. assuming tat p1, p2 and p3 are the priority variables, how can i use these variables to sort this itab at runtime ???

Thanks and Regards,

Ajit