SQL
Quick answer
ABAP developers mostly use Open SQL and CDS (which generate HANA SQL), but understanding native HANA SQL/SQLScript helps you write efficient CDS, optimise, and work directly with HANA when needed.
Key takeaways
- HANA supports standard SQL for the usual SELECT/INSERT/UPDATE/DELETE plus rich analytical features (window functions, aggregations…
- SQLScript adds procedural constructs (variables, control flow, table variables) so you can implement more complex logic as stored…
- The guiding principle on HANA is code-to-data: bring the computation to where the data lives (the database) rather than moving…
- Watch out: Row-by-row processing instead of set-based SQL.
HANA SQL
HANA supports standard SQL for the usual SELECT/INSERT/UPDATE/DELETE plus rich analytical features (window functions, aggregations, joins). Because HANA is columnar and in-memory, set-based SQL that aggregates and filters in the database is extremely fast, far better than pulling rows out and looping.
SQLScript for logic
SQLScript adds procedural constructs (variables, control flow, table variables) so you can implement more complex logic as stored procedures and functions that run inside HANA. This is central to code pushdown: move data-intensive logic to the database instead of the application server.
Code-to-data
The guiding principle on HANA is code-to-data: bring the computation to where the data lives (the database) rather than moving large data sets to the application. Well-written SQL/SQLScript and CDS embody this, delivering big performance gains over row-by-row ABAP.
In the SAP context
ABAP developers mostly use Open SQL and CDS (which generate HANA SQL), but understanding native HANA SQL/SQLScript helps you write efficient CDS, optimise, and work directly with HANA when needed.
Common pitfalls
- Row-by-row processing instead of set-based SQL.
- Pulling data out rather than pushing logic down.
- Ignoring window/aggregate functions HANA does well.
Want to learn this properly?
Our live, instructor-led SAP Training covers this hands-on, with real projects and a certification path.
Check your understanding
Which statement is true of SQL?
- A. Performance tuning keeps SAP fast and scalable by finding and fixing bottlenecks across the database…
- B. Fiori catalogs are the collections of apps (and their tiles/targets) that define what is available to assign…
- C. Because HANA is columnar and in-memory, set-based SQL that aggregates and filters in the database is…
Show answer
C. Because HANA is columnar and in-memory, set-based SQL that aggregates and filters in the database is…
Covered in the “HANA SQL” section of this lesson.
Which of these also applies to SQL?
- A. Memorising answers without understanding.
- B. Wrong API for the job (e.g. synchronous where async is needed).
- C. SQLScript adds procedural constructs (variables, control flow, table variables) so you can implement more…
Show answer
C. SQLScript adds procedural constructs (variables, control flow, table variables) so you can implement more…
Covered in the “SQLScript for logic” section of this lesson.
Which part of the Learn SAP curriculum covers SQL?
- A. SAP MM
- B. SAP HANA
- C. SAP performance tuning
Show answer
B. SAP HANA
This lesson sits in the SAP HANA section of the Learn SAP course.