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: 

Sorting of a generic internal table

Former Member
0 Kudos

Hello

I have the following situation: In my coding I have a generic table containing any data and I know the corresponding table type stored in a string. Now I'm looking for a way to sort such generic internal table by a component.

Any help is appreciated.

Thanks,

Mathias

3 REPLIES 3

Former Member
0 Kudos

can u paste some code of urs so that the problem becomes clear....

Former Member
0 Kudos

I found a solution:


  DATA: lt_data TYPE data.

  FIELD-SYMBOLS:
    <lt_data>      TYPE any TABLE.

  assign lt_data to <lt_data>.

  try.
    sort <lt_data> by ('TYPE') ASCENDING.

former_member230674
Contributor
0 Kudos

Hi Mathias,

You can sort a standard or hashed table in a program.If the table is a generic sorted table, the SORT statement causes a runtime error if the sort key is not the same as an extract of the beginning of the table key.The SORT statement is only allowed for generic internal tables, if it does not violate the internal sort order.

I hope , this information should useful to you.

by

Prasad GVK.