‎2008 Jun 26 8:56 PM
Dear ABAPers,
In the program there is a statement
SORT nbseg BY txgrp.
Even though the table is already sorted by tax group, that is in my case, the first item of the invoice ahs tax group 000 and all the rest have 001.
As soon as the sort statemet is executed, the first item remains as it is, but the rest of the items change positions. item number 329 comes second, 170 comes 3rd etc even though they have same tax group.
Any idea how the sort statement works when the field has identical values?
Would be glad to award points for helpful answers.
Regards
Veena
‎2008 Jun 26 9:03 PM
‎2008 Jun 26 9:05 PM
Thank you, but I am not developing the program and trying to resolve the issue in an existing program. Because of this sorting pattern we do not have the last item of the invoice being read last.
‎2008 Jun 26 9:08 PM
sorry.. i was trying to edit my last post to reflect your real question..
it probably has something to do with the columns to the left of the field you are sorting. if you are particular about those other fields, you should sort them in sequence as well.
sort itab by txgrp field2 field3 .... ascending.
‎2008 Jun 26 9:24 PM
Thanks so much for the answers, but i still have one question.
If the 3 records in the internal table look like below
Tax group
1 2133 1800002056 000 001 D S
2 2133 1800002056 001 002 S S
3 2133 1800002056 001 003 S S
4 2133 1800002056 001 004 S S
5 2133 1800002056 001 005 S S
Then ideally after sorting by tax group, the records should remain as they are right? Wierdly, in some cases the records remain as they are but for some invoices they get shifted, any thoughts?
‎2008 Jun 26 9:25 PM
Sorry in my previous post, tax group column is the one with
000
001
001
001
001
‎2008 Jun 26 9:08 PM
hi there try sorting using item number as well
SORT nbseg BY item_no txgrp.
is notthing is mention in sort its ascending by default.
‎2008 Jun 26 9:08 PM