‎2006 Oct 17 1:17 PM
i have a requirement.
I am looking to sort an internal table with wbs element. I want to sort the internal table such a way that all the entries that have wbs element appears at top in ascending order and then those that dont have wbs element.
if i try sort ascending then blank entries come first.
help please..
thanks in advance
Hitesh
‎2006 Oct 17 1:24 PM
Hi
U can try to do something like this:
ITAB-WBS = 'ZZZZZZZZZ'.
MODIFY ITAB TRANSPORTING WBS WHERE WBS = SPACE.
SORT ITAB BY WBS.
CLEAR ITAB-WBS.
MODIFY ITAB TRANSPORTING WBS WHERE WBS = 'ZZZZZZZZZ'.
So u insert a value where the WBS is blank, sort the table and then clear WBS where u have inserted the false value.
Max
‎2006 Oct 17 1:19 PM
Hello,
Use SORT ITAB <b>DESCENDING</b> by POSID.
If useful reward.
vasanth
‎2006 Oct 17 1:24 PM
Hi
U can try to do something like this:
ITAB-WBS = 'ZZZZZZZZZ'.
MODIFY ITAB TRANSPORTING WBS WHERE WBS = SPACE.
SORT ITAB BY WBS.
CLEAR ITAB-WBS.
MODIFY ITAB TRANSPORTING WBS WHERE WBS = 'ZZZZZZZZZ'.
So u insert a value where the WBS is blank, sort the table and then clear WBS where u have inserted the false value.
Max
‎2006 Oct 17 1:38 PM
It is not possible to achieve that by the SORT statement on WBS Element.
The only solution is that you include a field in the internal table say KEY and populate the same with '1' if WBS Element is not space and '9' if it is space.
After that sort the internal table using key and wbs element.
SORT itab by key wbselement.
Result of the same would be as you want.
Regards
Anurag