‎2009 Oct 15 12:29 PM
Hi,
When i did a select stetement with limited fields on MSEG, records are coming in to a internal table but the order of these records in internal table is strange. I want to know what would be the basis?. when i see the records in SE16 the order is based on Item number. but in internal table records are in different order.
Please let me know why it is.
Thanks in advance....
Mohan
‎2009 Oct 15 12:34 PM
after your select... sort internal number on item number
Regards,
Nikhil
‎2009 Oct 15 12:41 PM
Hi,
If you are not using all the key fields in where condition this does happen...also you need to use the fields in same order while selecting them in select query...
else you need to define the internal table as SORTED table..
Regards
Shiva
‎2009 Oct 15 12:55 PM
Hi Jagan,
After ur select query try to use sort query as shown
select * from MSEG into table itab.
sort itab by mblnr.
Here i am sorting with the field MBLNR, if u want you can sort with your required field
but if you sort with primary key field it gives good performance.
Cheers!!
VEnk@
‎2009 Oct 15 1:14 PM
Hi,
I don't want to do any sorting after selecting because of some other issues. This program is working fine from last several days and we got this issue now only.. so please let me know how to select statement behavious.
Thanks a lot in advance...
‎2009 Oct 15 1:25 PM
"I don't want to do any sorting after selecting because of some other issues" share your reasons.
And you can do one more thing like modify your select query using Order BY clause for your example
see the below link
http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm
and in tht link u can see at the last ORDER by clause.
Or else put a breakpoint and debug from where and how the data is been populating so tht u can get an idea on
the issue.
Cheers!!
VEnk@
‎2009 Oct 15 1:27 PM
You have a relational database. In a relational database, there is no concept of order of records. You are getting in your internal table, the actual order of the records in the database. SE16 presumably sorts by key.
matt
‎2010 Jun 03 6:46 AM