Procedures
Quick answer
ABAP can call HANA procedures (via AMDP, ABAP-managed database procedures) to push heavy logic down.
Key takeaways
- A stored procedure is reusable SQLScript logic stored in HANA and callable by name.
- Prefer views (calculation/CDS) for read/query models, they are optimised and reusable.
- Input/output parameters and table parameters.
- Watch out: Row loops in SQLScript instead of set operations.
What procedures are for
A stored procedure is reusable SQLScript logic stored in HANA and callable by name. Procedures are used when logic is too complex for a single view or must run in steps, complex calculations, data transformations, or operations that update data, all executed close to the data for performance.
SQLScript features
- Input/output parameters and table parameters.
- Local variables and table variables.
- Control flow (IF, loops) alongside set-based SQL.
- Read-only vs read-write procedures.
When to use a procedure vs a view
Prefer views (calculation/CDS) for read/query models, they are optimised and reusable. Use procedures when you need procedural steps, side effects (writes), or logic that does not fit a declarative view. Favour set-based operations inside procedures over row loops for performance.
In SAP applications
ABAP can call HANA procedures (via AMDP, ABAP-managed database procedures) to push heavy logic down. AMDP lets developers write SQLScript within ABAP classes, combining ABAP lifecycle with HANA-side execution.
Common pitfalls
- Row loops in SQLScript instead of set operations.
- Procedures where a view would do (less reusable).
- Heavy logic in ABAP that should be pushed down (AMDP).
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 Procedures?
- A. A client is a self-contained tenant within an SAP system, with its own master data, transaction data and…
- B. Working with IDocs in ABAP means generating, processing and enhancing the intermediate documents SAP uses for…
- C. Procedures are used when logic is too complex for a single view or must run in steps, complex calculations…
Show answer
C. Procedures are used when logic is too complex for a single view or must run in steps, complex calculations…
Covered in the “What procedures are for” section of this lesson.
Which of these also applies to Procedures?
- A. Basic auth over HTTP, credentials exposed.
- B. Prefer views (calculation/CDS) for read/query models, they are optimised and reusable.
- C. Skipping the discipline under delivery pressure.
Show answer
B. Prefer views (calculation/CDS) for read/query models, they are optimised and reusable.
Covered in the “When to use a procedure vs a view” section of this lesson.
Which part of the Learn SAP curriculum covers Procedures?
- A. SAP labs
- B. Getting started
- C. SAP HANA
Show answer
C. SAP HANA
This lesson sits in the SAP HANA section of the Learn SAP course.