Sub topic 3
SAP HANA as the Required Database
This chapter assumes you know the difference between a database and an application layer. It also assumes you have worked with ECC, where the database could be Oracle, IBM Db2, Microsoft SQL Server, SAP ASE, or SAP MaxDB.
From "any database" to one database
ECC 6.0 was database-independent. The ABAP application server talked to the database through Open SQL, so the same code ran on several vendors' products. SAP S/4HANA removes that choice. It runs only on SAP HANA, an in-memory database that keeps its working data in main memory (RAM) and persists it to disk for durability.
This is a platform requirement, not a tuning option. You cannot convert to S/4HANA and stay on your current database. If your ECC system runs on Oracle, the conversion also includes a database migration to HANA.
What "in-memory" means in practice
HANA differs from the databases ECC used in three ways that matter for S/4HANA:
- Column store. Tables are stored by column instead of by row. Aggregating one field over millions of rows reads only that column.
- Compression. Values in a column repeat often, so they compress well. This reduces memory use and speeds up scans.
- Parallel processing in memory. Queries run across many CPU cores on data already in RAM, with no disk reads on the hot path.
Together, these make it fast enough to sum line items on demand. That is why S/4HANA can drop many stored aggregate tables, which the next chapter covers.
Code pushdown
On a row-store database, ABAP programs often fetched large result sets and processed them in the application server. With HANA, the better pattern is code pushdown. You let the database do the calculation and return only the result.
The following query sums a balance in the database and returns a single value:
SELECT SUM( hsl ) AS total_amount
FROM acdoca
WHERE rldnr = '0L'
AND rbukrs = '1000'
AND gjahr = '2024'
AND racct = '0000400000'
INTO @DATA(lv_total).The alternative is to select all matching rows into an internal table and add them in an ABAP loop. That works, but it moves far more data between the layers. Core Data Services (CDS) views and ABAP-managed database procedures extend the same idea to more complex logic.
Common errors and gotchas
- Treating HANA as a drop-in swap. Existing custom code usually still runs, but code that relied on database-specific behavior, such as native SQL or Oracle hints, can fail or perform badly.
- Sizing by disk instead of memory. HANA needs RAM for the working data set. Undersized memory is a common cause of poor performance.
- Assuming speed without redesign. Code that reads rows one at a time in loops will not benefit much. Performance gains often need pushdown.
- Forgetting the migration step. A system conversion includes moving data to HANA. Plan the downtime and testing for it.
Exercise
Your ECC 6.0 system runs on Oracle. A colleague proposes converting to S/4HANA and keeping Oracle to avoid a database migration. Is this possible, and why does HANA's design make S/4HANA's data model practical?
Show answer
It is not possible. S/4HANA runs only on SAP HANA, so the conversion includes a move to HANA. HANA's in-memory column store, compression, and parallel processing make it fast to aggregate line items on demand, so S/4HANA can remove many stored aggregate tables.