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: 

sort with out sort command

Former Member
0 Kudos

How can we sort the internal table with out sort command.

6 REPLIES 6

h_senden2
Active Contributor
0 Kudos

I don't think it's possible. You can appending the entries in a sorted way. But when you enter another record that not fit the sorting, you have to sort it with the sort statement.

Why can't you use the sort statement ?

regards

Hans

Message was edited by: Hans Senden

Former Member
0 Kudos

y r u not want to use sort...

it is very simple to write .

sort itab....

Former Member
0 Kudos

Hi,

When retrieving the data from the database table into internal table, use order by clause to sort the contents,

Rgds,

andreas_mann3
Active Contributor
0 Kudos

hi,

use sorted table

Former Member
0 Kudos

DECLARE A SORTED INTERNAL TABLE.

DATA : ITAB TYPE SORTED TABLE OF MARA WITH UNIQUE KEY MATNR.

Now, whatever data you are inserting into ITAB will be SORTED automatically.

You CANNOT use APPEND statement with SORTED tables, have to use INSERT statement. You don't have to use the SORT statement.

regards,

Ravi

Note : Please mark all the helpful answers and close the thread if the issue is resolved.

former_member188685
Active Contributor
0 Kudos

hi,

you can declare your itab as sorted table.then it will be automatically sorted with out sorting it.you can do this way...

data: itab type sorted table of mara with non-unique key matnr.

Regards

vijay