‎2007 Apr 30 1:17 AM
Hi Experts,
I hv code like,
1 Code) :
<i><b> sort itab by charg.
sort itab by invnr.</b></i>
2 Code):
<i><b>sort itab by charg invnr.</b></i>
Is that the above two codes wuld yields the same result? Or not?
ThanQ.
Message was edited by:
Sridhar
‎2007 Apr 30 1:22 AM
Not necessarily the same result as in the two cases, the sort order is different ie
when u sort by only one field, the itab is sorted by that field.. in the first case, the second sort overrides the first sort ie the itab will be sorted by invnr.
whereas in the second case the itab is sorted first by charg & then by invnr.
~Suresh
‎2007 Apr 30 1:22 AM
Not necessarily the same result as in the two cases, the sort order is different ie
when u sort by only one field, the itab is sorted by that field.. in the first case, the second sort overrides the first sort ie the itab will be sorted by invnr.
whereas in the second case the itab is sorted first by charg & then by invnr.
~Suresh
‎2007 Apr 30 1:38 AM
OK, ThanQ.
So, here, the following 2 statements r immediately written,
1 Case):
sort itab by charg.
sort itab by invnr.
So, instead, programmer can write only one statement as blow,
2 Case):
sort itab by invnr.
by expecting the same result!
R the above 2 cases wuld yield the same result?
ThaNQ.
‎2007 Apr 30 2:11 AM
In this case, those statements would yeild the same results. Because, in number 1, the last statement is the same as the statement in number 2. So in number 1, the table is sorted by the last SORT statement.
In your original post, the statement with boths fields will sort by the first, and then by the second collectively, when you separate the fields into two separate SORT statements, you are simply sorting by that field.
Regards,
Rich Heilman
‎2007 Apr 30 3:28 AM