Application Development 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: 

Diffrence of Entries order between ECC6.0 and S4HANA when use SELECT syntax

0 Kudos

Hi experts.

I have task that should make same entries order between ECC and S4hana when i use SELECT syntax and insert that data record to Internal table.

Problem is If the ECC program source have order key from SELECT syntax or have internal table sort key column, i can solve problem easily throughout apply that order key or internal table sort key to S4 hana environment , but no keys in the ECC program source code.. so i have no idea how can i make it.

in this case, how can i make same S4 hana internal table entries from inserting SELECT syntax with ECC internal table entries?

Of course, i can't modify ECC environment program source code but can S4hana source code.

Kim

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

If I understand well your question, it's a frequently-asked one in the forum.

People think that SELECT always sorts by default based on primary key. It often happens, but it's just because the SQL optimizer often estimates that using the index of the primary key is the fastest way to read the table.

If you want to sort, you MUST sort explicitly the entries. It's recommended to sort in ABAP (SORT) rather than in SQL (ORDER BY), in order to relieve the database server from extra work, and because there are often several ABAP application servers for one DB server.

7 REPLIES 7

Sandra_Rossi
Active Contributor

If I understand well your question, it's a frequently-asked one in the forum.

People think that SELECT always sorts by default based on primary key. It often happens, but it's just because the SQL optimizer often estimates that using the index of the primary key is the fastest way to read the table.

If you want to sort, you MUST sort explicitly the entries. It's recommended to sort in ABAP (SORT) rather than in SQL (ORDER BY), in order to relieve the database server from extra work, and because there are often several ABAP application servers for one DB server.

Hi Sandra.

I appreciate to your opinion.

So I just recongnize i should fix the ECC environmnet programming source no having certain column sort key(not SQL ORDER BY) firstly and modify S4 hana programming code.

thank you very much!

regard

matt
Active Contributor
0 Kudos

It's recommended to sort in ABAP (SORT) rather than in SQL (ORDER BY), in order to relieve the database server from extra work, and because there are often several ABAP application servers for one DB server.

sandra.rossi Really? I've always understood to have the db server do what the db server is good at - and that includes retrieving records that are ordered by ORDER BY.

matt
Active Contributor
0 Kudos

dkssudrnfk23 In my opinion on the HANA side you definitely should have the ORDER BY in the SQL.

0 Kudos

matthew.billingham

At least, trust me that ABAP is able to do as good as the database server on sorting 😄

Now, maybe it's a bias of ABAPers who are not database administrators, to think that they can handle it better than administrators.

I don't think it's bad to do it in ABAP.

matt
Active Contributor

sandra.rossi I usually select into an sorted table anyway, if I care about the order!

matt
Active Contributor
0 Kudos

Records from ANY relational database may come in ANY order. Without adding an ORDER BY, you cannot guarantee they'll be in a particular order.