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

sort

Former Member
0 Likes
945

hi ,

is there a way to unsort the sorted internal table,

Thanks

10 REPLIES 10
Read only

Former Member
0 Likes
924

ofcourse there is Keyword SORT

SORT Itab by fieldname.

Regards,

Reema.

Read only

0 Likes
924

Hi,

There is no specific keyword for unsort. Only thing you can do is sort with a field different from the field which you dont need to be sorted.

For ex if you have fields X and Y and you have already sorted with X, then try sorting with Y if you dont want the field X to be sorted.

This will change the order of the sort.

But as such you cant get back unsorted data.

Regards,

Yogesh

Read only

Former Member
0 Likes
924

first identify u'r criteria for unsort, then apply SORT statement with that criteria.

cheers

S@meer

Read only

gopi_narendra
Active Contributor
0 Likes
924

Simple just take out the SORT statement from your program is a logical answer. right??

Regards

Gopi

Read only

Former Member
0 Likes
924

hi,

make the copy of original internal table and then sort the copied one and use. in this manner u will be able to access both sorted and unsorted internal table.

reward points.

regards

Abhilasha

Read only

Former Member
0 Likes
924

hI Anu

suppose if u r internal table is sorted on first field , if u want to it as a unsorted then the internal table on another field......

is this is ur req?

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
924

Why would you want to do that?.. why cant you just not sort it..?

explain the scenario..

Aparna

Read only

0 Likes
924

I am reading a file from application server into an internal table and sorting the internal table to calculate the opening balances and closing balances and paassing the file to standard SAP program.

The requirement here is to maintain the file as it is from the application server.

but for calculating using AT NEW account i need to sort it.

Thanks,

Aruna.

Read only

0 Likes
924

Hi ,

one option is , create one index field in that internal table and put a counter on it , after doing all ur calculations based that counter sort out ur final internal table.

data: n type sy-index.

n = 0.

loop at itab1.

move-corresponding itab to itab1.

itab-count = n.

n = n + 1.

endloop.

do something.

and sort based on that count.

Regards

Peram

Read only

Former Member
0 Likes
924

make a copy of the table before sorting..

then loop throught the sorted table after calculating the balances and modify the unsorted table wherever necessary..!!

Regadrs,

Aparna