CRITICAL
Rule Definition
In order to ensure a smooth migration to SAP HANA, it is crucial to ensure that existing ABAP code behaves the same after the migration as before. While the support for SAP HANA is fully compatible based on the specified and documented feature set of Open SQL, ABAP code relying on implicit sorting behavior (i.e. undocumented sorting behavior in Open SQL) may require adaptation.
For systems running of HANA, SAP recommends to keep load away from the database, but push data-intensive calculations to the database where applicable.
Remediation
Add ORDER BY in Open SQL queries based on the SELECT statement to sort the result set according to the usage done in the ABAP client code.
Violation Code Sample
SELECT guid partner_no partner_fct
FROM crmd_partner
INTO TABLE lt_crmd_partner
FOR ALL ENTRIES IN lt_links
WHERE guid EQ lt_links-guid_set AND partner_fct IN lt_proc_ranges.
READ TABLE lt_crmd_partner WITH KEY partner_fct = 'XX'
BINARY SEARCH.
Fixed Code Sample
SELECT guid partner_no partner_fct
FROM crmd_partner
INTO TABLE lt_crmd_partner
FOR ALL ENTRIES IN lt_links
WHERE guid EQ lt_links-guid_set AND partner_fct IN lt_proc_ranges
ORDER BY partner_fct.
READ TABLE lt_crmd_partner WITH KEY partner_fct = 'XX'
BINARY SEARCH.
Reference
SAP - Considerations for Custom ABAP Code When Migrating to SAP HANA - Best Practices and Recommendations
Related Technologies
Technical Criterion
Programming Practices - Unexpected Behavior
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.