Lesson 4: Advanced SAP Development Practices
Lesson 4: Advanced SAP Development Practices
1. ABAP Managed Database Procedures (AMDP)
Used for creating database logic in SAP HANA using SQLScript.
Enhance performance by executing logic directly in the database.
Allow seamless integration with ABAP programs.
2. SAP Fiori Elements
Simplifies app creation with predefined templates and metadata-driven UI.
Supports dynamic views with annotations.
Enables faster app deployment and consistency.
3. BRF+ (Business Rule Framework Plus)
Centralizes business rule management in SAP.
Offers a decision table interface for rule configuration.
Improves rule maintainability and reusability.
Code Example 1: AMDP Method Implementation
CLASS zcl_amdp_example DEFINITION.
PUBLIC SECTION.
INTERFACES: if_amdp_marker_hdb.
METHODS get_customers BY DATABASE PROCEDURE FOR HDB
LANGUAGE SQLSCRIPT USING zcustomer.
ENDCLASS.
CLASS zcl_amdp_example IMPLEMENTATION.
METHOD get_customers.
SELECT * FROM zcustomer INTO TABLE @lt_customers.
ENDMETHOD.
ENDCLASS.
Explanation
Implements an AMDP method using the
if_amdp_marker_hdb
interface.Executes SQLScript directly on HANA.
Fetches data from the
zcustomer
table.
Code Example 2: SAP Fiori List Report App
<ListReport
xmlns="sap.fe.templates"
entitySet="Customers"
navigationPropertyBinding="to_CustomerOrders">
</ListReport>
Explanation
Defines a Fiori List Report app using SAP Fiori elements.
Binds the app to an OData entity set
Customers
.Enables navigation to related
CustomerOrders
.
Code Example 3: BRF+ Decision Table
CALL FUNCTION 'FDT_PROCESS_TABLE'
EXPORTING
iv_table_id = 'DT123'
IMPORTING
et_result = lt_rules.
Explanation
Invokes a BRF+ decision table using function
FDT_PROCESS_TABLE
.Processes rules defined in the table with ID
DT123
.Outputs results into
lt_rules
.
Code Example 4: Dynamic SQL Execution
DATA(query) = 'SELECT * FROM zcustomer WHERE city = ?'.
EXEC SQL.
EXECUTE IMMEDIATE :query INTO :lt_data USING 'Berlin'.
ENDEXEC.
Explanation
Constructs a dynamic SQL query for flexible execution.
Filters
zcustomer
data by city using a parameter.Executes directly with improved performance.
Code Example 5: SAP Fiori Navigation Handler
onNavigate: function() {
var oRouter = this.getOwnerComponent().getRouter();
oRouter.navTo("CustomerDetails", { id: "123" });
}
Explanation
Implements a navigation handler in a SAPUI5 controller.
Uses
navTo
for routing to a specific page.Dynamically passes parameters like
id
.