‎2005 Dec 07 3:24 PM
Hi all,
In internal table i have data with vornr matnr and other fields.
My requirement is for each material number i have to sort the internal table descending with vornr for furthur processing.
My code is working fine with one material.but with more than one its not working.
ex:
internal table itab.
vornr matnr
1200 18
1800 18
1300 18
1100 19
900 19
1800 19.
Result table should be like this:
vornr matnr
1800 18
1300 18
1200 18
1800 19
1100 19
900 19.
Please help me.
regards
Chandu.
‎2005 Dec 07 3:27 PM
use "sort itab by vornr" statement..
oops i didn't read it throroughly..
first move the contents to another itab.
say itab1
whose structure is Matnr|Vornr
move the contents of itab to itab1.
sort itab1 by matnr vornr.
then move the contents bacl to itab.
Message was edited by: Ravi Kanth Talagana
‎2005 Dec 07 3:27 PM
use "sort itab by vornr" statement..
oops i didn't read it throroughly..
first move the contents to another itab.
say itab1
whose structure is Matnr|Vornr
move the contents of itab to itab1.
sort itab1 by matnr vornr.
then move the contents bacl to itab.
Message was edited by: Ravi Kanth Talagana
‎2005 Dec 07 3:28 PM
‎2005 Dec 07 3:29 PM
hi ravi,
i used the statement but its working fine for only one material.
‎2005 Dec 07 3:33 PM
I have edited my message, just look at it again.
Cheers Ravi
data: begin of itab occurs 0,
matnr like mara-matnr,
vornr....,
end of itab.
data: begin of itab1 occurs 0,
vornr....,
matnr like mara-matnr,
end of itab.
loop at itab.
move-corresponding itab to itab1.
append itab1.
clear itab1.
endloop.
refresh itab.
sort itab1 by vornr matnr.
loop at itab1.
move-corresponding itab to itab.
append itab.
clear itab.
endloop.
Regards,
Ravi
‎2005 Dec 07 3:34 PM
Hi alexandar and federik,
If i use sort itab by vornr matnr descending.
then the result is
vornr matnr
1800 18
1800 19
1300 18
1200 18
1100 19
900 19. instead of.
vornr matnr
1800 18
1300 18
1200 18
1800 19
1100 19
900 19.
I hope you understand
‎2005 Dec 07 3:38 PM
So,
Change it to:
sort itab by matnr ascending
vornr descending .
Alexandre Nogueira
‎2005 Dec 07 3:38 PM
I don't know if SAP will like that, but you would like to do :
sort itab by matnr ascending vornr descending.
Fred
‎2005 Dec 07 3:43 PM
‎2005 Dec 07 3:46 PM
Hi Sai,
For your info. After matnr no need to give ascending..its default.
Thanks
Eswar
‎2005 Dec 07 3:29 PM
‎2005 Dec 07 3:34 PM
Hi Sai,
Simply
sort itab by matnr vornr descending.
Thanks
eswar