SAP examples · LessonBy Anitha M, SAP Trainer, 13 yrs · Published · SAP S/4HANA 2023 · all levels
HANA examples
These HANA examples show data modeling and SQL on the in-memory database, a calculation/CDS view and set-based SQL, illustrating the code-to-data approach.
Quick answer
The examples embody code-to-data: aggregate and filter in the database (via CDS or SQL) rather than pulling rows into ABAP and looping.
Key takeaways
- Watch out: Row-by-row processing instead of set-based SQL.
- Worked examples: a cds view (application modeling), set-based sql (push logic down), what it teaches.
- How HANA examples fits into SAP development and the wider SAP landscape
A CDS view (application modeling)
define view entity Z_Sales_By_Cust as select from I_SalesOrderItem {
key SoldToParty,
sum( NetAmount ) as TotalNet
} group by SoldToPartySet-based SQL (push logic down)
SELECT sold_to, SUM(net_amount) AS total
FROM sales_items
GROUP BY sold_to
ORDER BY total DESC;What it teaches
The examples embody code-to-data: aggregate and filter in the database (via CDS or SQL) rather than pulling rows into ABAP and looping. On HANA this is dramatically faster. Layer views for reuse, and push filtering/aggregation as low as possible.
Common pitfalls
- Row-by-row processing instead of set-based SQL.
- Pulling data out to aggregate in ABAP.
- Monolithic views instead of layered/reusable.
Practice challenge
+0 XPStreak ×0
Question 1 of 3
Which statement is true of HANA examples?
Frequently asked questions
What does the term HANA examples refer to in SAP?
These HANA examples show data modeling and SQL on the in-memory database, a calculation/CDS view and set-based SQL, illustrating the code-to-data approach.
What else is worth knowing about HANA examples?
The examples embody code-to-data: aggregate and filter in the database (via CDS or SQL) rather than pulling rows into ABAP and looping.
What tends to go wrong with HANA examples?
Row-by-row processing instead of set-based SQL. Pulling data out to aggregate in ABAP. Monolithic views instead of layered/reusable.