Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Selection query problem

Former Member
0 Likes
476

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

4 REPLIES 4
Read only

Former Member
0 Likes
445

Please use statement SORT on Required fileds after SELECT.

Regards,

J.

Read only

Former Member
0 Likes
445

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

Read only

alex_m
Active Contributor
0 Likes
445

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.

Read only

Former Member
0 Likes
445

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