‎2009 Jun 29 8:26 AM
Hi,
I am selecting line items based on an invoice. But after selection, line items are not sequentially. But if I go to SE16 and view those data, they are coming in correct sequence( ascending order ). I checked with the fields' positions in the table level also. Query has the same sequence. But still it is in mis order. What may be the reason. How can I get in ascending order while selection itself.
Thanks and regards,
Venkat
‎2009 Jun 29 8:29 AM
Please use statement SORT on Required fileds after SELECT.
Regards,
J.
‎2009 Jun 29 8:29 AM
Hi,
Use ORDER BY addition in your select statement with the fields you want to be in order
Do F1 on select to get more information about order by
or
check this link [ORDER BY|http://help.sap.com/erp2005_ehp_04/helpdata/EN/fc/eb3a53358411d1829f0000e829fbfe/frameset.htm]
Regards
Sarves
‎2009 Jun 29 8:29 AM
Ideally the select statement picks the records in order which the where clause condition matches, you are using QUERY for your report or a custom program?. Try to sort the table after the select by invoice and item number.
‎2009 Jun 29 8:31 AM
Hi Venkat,
If you are not geting item number in sequence then you can sort internal table according to item number after selection. But if you want it in your select query itselft then put key work ASCENDING in select query.
Regards,
Vijay