Open SQL Part 9: HANA-Friendly SQL and Code Pushdown
Preview · a free account unlocks the full lesson
Adapt classic SQL habits for SAP HANA: fewer round trips, aggregation and calculation in the database, SQL expressions (CASE, CAST, string/date functions), subqueries, and when to move logic into CDS views.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Parts 1 through 8 of this series taught correct and measured SQL; after a move to S/4HANA or Suite on HANA, the same code often runs faster, but classic patterns that move data to ABAP still waste most of HANA's strength, so this part is about adapting to the database's actual behavior rather than micro-optimizing ABAP.
What changes with HANA: its column store makes reading few columns across many rows very fast, while a SELECT * against wide tables becomes costly; in-memory aggregation and joins are very fast; many of the secondary indexes a classic database needed become unnecessary, and some statements need a different approach entirely; and the expensive part of the whole operation is the round trip and data transfer between the application server and the database — so the biggest wins come from fewer round trips and less data transferred, not from fine-tuning ABAP itself, and work should be pushed to the database wherever possible: filtering, joins, aggregation, and calculations expressed as SQL.
Code pushdown in ABAP SQL, using the strict syntax from release 7.40 SP05 onward, can include calculations such as price * seatsocc AS revenue; CASE expressions such as CASE WHEN seatsocc >= seatsmax THEN 'FULL' ELSE 'OPEN' END AS status; CAST, COALESCE, string functions (CONCAT, SUBSTRING, UPPER), date functions (DATS_DAYS_BETWEEN), and arithmetic functions (ROUND, DIV); aggregations with GROUP BY and HAVING, as covered in Part 6; subqueries such as WHERE EXISTS ( SELECT … ) or IN ( SELECT … ); and, in newer releases, common table expressions using WITH.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Related SAP topics
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.