AMDP in BW Context
AMDP in BW Context
BW Transformation and
HANA exit variables
SAP BW 7.4 Support Package 5 SAP 7.4 Support Package 8 SAP BW 7.50 Support Package 04
• Transformations using only standard • The option to implement customer-specific • SQL Script (AMDP) based Start-, End-, and
formula/functions will be processed in the transformations directly in the SAP HANA Field Routines
SAP HANA database database. • Support for error Handling using AMDP
• Any transformations containing custom • Only support for expert routines using an
routines (i.e. ABAP coding) is still executed ABAP Managed Database Procedure
on the SAP application server. (AMDP) in the SAP HANA SQLScript
• This enables fast processing of language
transformations in many cases already, • Enabling error handling will force the
when using standard rule types including execution in application server.
formulas and look-ups in DataStore Objects
or master data
• Choose the created BW Project in the upcoming dialog. Next start the BW Workbench (RSA1) within the embedded SAP GUI and create the BW
transformation or switch into the edit mode for an existing one.
• Create start/end/field or expert routine. Chose AMDP script
• In the next step the BW framework opens the AMDP class by calling the ABAP Development Tools for SAP NetWeaver (ADT). For this an ABAP project
is needed. Select an existing ABAP Project or create a new one in the dialog.
• Insert the relevant code in the method procedure and activate the AMDP class.
• Go back to the BW transformation and activate the transformation to regenerate the
calculation scenario.
Note – The AMDP class should always be a $TMP object and it should not be manually
collected in any transport request. Every time a change needs to be transported the
corresponding transformation and DTP should be activated and collected in TR.
This declaration specifies the method to the HANA database (HDB), the
language to SQLSCRIPT and further on defines that the database procedure is
READ ONLY. The read only option means that the method / procedure must be
side-effect free. Side-effect free means that only SQL elements (DML) could be
used to read data. Elements like DELETE, UPDATE, INSERT used on persistent
database objects are not allowed. These data modification statements can also
not be encapsulated in a further procedure.
You cannot directly read data from a database object managed by ABAP like a
table, view or procedure inside an AMDP procedure
The USING option must be added at the end of the declaration part
The SAP HANA Script has two parameters, one importing (inTab) and one
exporting (outTab) parameter. The importing parameter provides the source
data package and the exporting parameter is used to return the result data
package.
Sample Code -
• Within the BW all fields are defined as NOT NULL columns. Therefore, the developer is responsible to ensure that all data inside the result table of a
SQL Script routine are initialized. The SQL function COALESCE could be used to avoid NULL values and ensure that all values would be initialed correct in
case of NULL values. Characteristic sample:
COALESCE( intab.”Material”, ‘ ‘ ) as “MATERIAL“
• Make use of filter pushdown as much as possible
• To concatenate blank spaces between two strings, use CHAR function. Blank space is denoted by CHAR(32).
SELECT 'A' || CHAR(32) || 'B' || CHAR(32) || 'C' FROM <any table>;
• Keep internal tables as small as possible.
• Use distinct to reduce the cartesian product of two joined tables.
• AMDP field routines are different to ABAP field routines. The AMDP routine expects the output to have the same number of lines as the input. There is
no looping concept in AMDP field routines unlike ABAP.
• Generating additional records and looping using DB cursors are best avoided. It is recommended to use ABAP routines for such scenarios.