How to create an AMDP Routine in BW Transformations
How to create an AMDP Routine in BW Transformations
What is AMDP ?
ABAP-Managed Database Procedures is one of the recommended patterns for use in ABAP code optimization within the context of ABAP development on SAP HANA.
Since ABAP-Managed Database Procedures are implemented as methods of a global ABAP class, the editing environment for AMDP is the ABAP class editor. In concrete terms, an ABAP-Managed Database Procedure is written in a database-specific language, such as Native SQL or SQL Script, and is implemented within an AMDP method body of an AMDP class. So developing a database procedure is similar to the editing of ABAP class methods with the same tool environment
Let’s start with some simple examples in how to setup an AMDP routine in a BW transformation.
Example 1 : One to One mapping from Source to Target in the End Routine
- Create a transformation between the datasource and aDSO
- Map all the fields one to one
- Create and End Routine with AMDP script
In order to just map all the fields one to one without any restriction , you can easily write the following statement .
inTab = Contains all the fields available in the Source (Datasource)
OutTab = Contains all the fields available in the Target (aDSO)
Check the result
Example 2 : One to One mapping from Source to Target with some restrictions
Let re-use the above scenario but implement some restrictions while loading the data.
- Only select Product = A
- QTYSOLDINPC > 400
Translate those conditions in the below statement and it should result in only 1 specific record
Check the result:
These are some simple examples to illustrate the use of AMDP routines. These can also be implemented as a Start routine or in Field Routines.