01-10-2015 3:54 AM
Hi,
If an internal table is sorted or almost sorted, if we sort it again, does it take the same time as it is not sorted at all?
I ask this question because sometimes you do some modifies on a long code which is written by others, you don't want to read the entire code but you need a sorted internal table. If sort a sorted table doesn't take too much time, then I can singly put a SORT before entering LOOP.
Otherwise I have to read the all code to make sure the internal table is sorted only once.
01-11-2015 2:11 AM
Hi Ming,
I think it will sort it again and less time take, due to there is no flag to indicate this itab increased data or not compare with last sort.
regards,
Archer
01-11-2015 5:13 AM
Hi Ming,
I think we cannot sort the sorted table.
correct me if i am wrong.
Thanks,
Marimuthu.K
01-11-2015 7:00 AM
Ming is saying the table has been sorted, not that it is of type SORTED.
The correct way to approach this is to define your table as SORTED. That way you don't have to worry about whether it is already sorted. If you need more than one sort order, then when you define the table, define the additional sort keys.