This document, created by Siva Satya Sai Vanapallli, provides a comprehensive overview of ABAP Managed Database Procedures (AMDP) within SAP HANA-based systems. ABAP Managed Database Procedures (AMDP) are ABAP methods containing SQLScript code that are executed directly within the SAP HANA database. AMDPs are used for performance optimization by pushing data-intensive logic to the database level, leveraging HANA’s capabilities, and are managed within the ABAP environment using ABAP classes as containers.
Key list of topics covered in the document:
- AMDP Class and Method Creation: This involves using ABAP Development Tools (ADT) in Eclipse to create an ABAP class, marking it as an AMDP class by implementing the IF_AMDP_MARKER_HDB interface, and defining methods with the BY DATABASE PROCEDURE addition to write SQLScript logic.
- AMDP Method Implementation using SQLScript: This step details writing the actual database logic using HANA SQLScript within the AMDP method, including defining input/output parameters (variables and tables only, passed by value), and adhering to specific syntax rules like the USING clause for database objects and the absence of ABAP statements.
- Calling AMDP Methods: Explains how to execute AMDP methods from within ABAP programs (like standard ABAP methods) and from other AMDP methods (like static method calls), highlighting the syntax and best practices for each scenario.
- Data Types, Variables, Constants, and Operators in AMDP: Covers the SQLScript data types available in AMDPs, declaration of variables and constants, and the various operators (arithmetic, comparison, logical, string, set) that can be used within SQLScript logic.
- SELECT Statements and System Variables in AMDP: Describes how to perform data retrieval using SELECT statements within AMDP, including the USING clause for tables and accessing system context information like client, user, date, and language via SESSION_CONTEXT functions.
- Internal Tables, Flow Control, and Database Operations in AMDP: Details the use of internal tables in SQLScript for intermediate data storage, implementing flow control using IF conditions and loops (FOR, WHILE), and performing database modifications (INSERT, UPDATE, DELETE) directly from within AMDP methods.
- AMDP Database Functions (CDS Table Functions): Explains how to create AMDP-based database functions by defining CDS table functions and implementing their logic in AMDP methods, enabling the creation of reusable, database-level functions that return tabular data.
By utilizing AMDP, developers can effectively optimize SAP HANA-based ABAP applications by executing performance-critical database operations directly within the HANA database, reducing data transfer and improving overall system efficiency.