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

Regarding itab data order after doing select

Former Member
0 Likes
1,189

Hi Gurus,

This question may sounds silly. But i would like to know the reason behind it.

Currently we are doing a support project in which we are facing this problem.

The program has to fetch the data from a ztable and do manipulation and display the output.

But after selecting the data from the ztable in both quality and production server the order of data in internal table is not the same but the data remains the same in the table level.

even i checked the version of program in production and quality both are same, and the amount of data in both the system is also the same.

Now i need to know why the order of the data is different in both the server? list out the possiblities of this cause?

Note i have compared the table version aswell no change and no index is also there .

Looking forward for your positive response.

Regards

S.Janagar

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,133

If you don't sort the internal table or dont use an ORDER BY key in the SELECT statement, the actual order of records may, and will, vary. The SQL optimizer may choose different access to data and the data is not actually sorted by primary key in the database for many DB system, you have this false impression cause SE16 execute a SORT internal table before display. (look after start-of-selection in the /1BCDWB/DBxxxx report.)

In you case, execute ST05 on three systems, and compare also index, and how were the system created, the copy of system may have reorganized the tables in some sysyems...

In either cases, you cannot and must not rely on the database to order the records if required.

Regards,

Raymond

6 REPLIES 6
Read only

former_member491621
Contributor
0 Likes
1,133

Hi Janagar,

But after selecting the data from the ztable in both quality and production server the order of data in internal table is not the same but the data remains the same in the table level.

Could you please explain the above statement?? if possible with an example.

Read only

Former Member
0 Likes
1,133

Hi friend,

after executing the select statement , the data would be filled in internal table and the order of data in internal table varies in both production and quality servers. this is what i mean.

Regards

S.Janagar

Read only

0 Likes
1,133

Hi Janagar,

data in DB Table(Quality)      Data in internal table

1                                                  2

2                                                  1

3                                                  4

4                                                  3

Do you mean that this happens after data selection?? If the above is the case, You can sort the data as per your requirement.

I don't see a problem here

Read only

vinoth_aruldass
Contributor
0 Likes
1,133

hi

may be the time of uploading of data vary.

but after data reaches to itab you can sort it up to what ever you expect.

hope it helps,

Vnoth.

Read only

Former Member
0 Likes
1,133

nice point. but the development and production behaves exactly the same but quality alone is behaving weird.

Any more suggesions

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,134

If you don't sort the internal table or dont use an ORDER BY key in the SELECT statement, the actual order of records may, and will, vary. The SQL optimizer may choose different access to data and the data is not actually sorted by primary key in the database for many DB system, you have this false impression cause SE16 execute a SORT internal table before display. (look after start-of-selection in the /1BCDWB/DBxxxx report.)

In you case, execute ST05 on three systems, and compare also index, and how were the system created, the copy of system may have reorganized the tables in some sysyems...

In either cases, you cannot and must not rely on the database to order the records if required.

Regards,

Raymond