0% found this document useful (0 votes)
444 views14 pages

AMDP in BW Context

Uploaded by

Saha2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
444 views14 pages

AMDP in BW Context

Uploaded by

Saha2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

AMDP in

BW Transformation and
HANA exit variables

IBM Proprietary | © 2017 IBM Corporation 1


Introduction

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

IBM Proprietary | © 2017 IBM Corporation 2


Feasibility

Data Targets Prerequisites


The following objects are supported as targets: Minimum Releases and Support Packages:
• DataStore Objects (classic): standard and write-optimized types • SAP HANA Release 1.0 Support Package Stack 8 or
• DataStore Objects (advanced): all types but not with “InfoCube” settings higher (recommended: SPS 12 or higher)
• Semantically-Partitioned Objects based on DataStore Objects • SAP BW Release 7.4 Support Package 8 or higher
•Open hub destinations with database tables (without database connection) or third-party tools (recommended: 7.5 SP 4 or higher)
As of SAP BW 7.5 also the following targets are supported: Development Tools:
• DataStore Objects (advanced): all types including with “InfoCube” settings • SAP HANA Studio (recommended: version 2.3 or
• InfoObjects higher)
• InfoCubes • SAP BW Modeling Tools for Eclipse (recommended:
version 1.14 or higher)
• ABAP Development Tools for Eclipse
(recommended: version 2.60 or higher)
Restrictions System Configuration:
The following objects are not supported for executing transformations in SAP HANA: • SAP BW Data Transfer Process settings
• Queries as InfoProviders are not supported as the source • ABAP Managed Database Procedure
• ABAP routines are not supported implementation
• Rule groups are not supported • System privileges to allow usage of ABAP Managed
• Customer-defined functions in the formula editor are not supported Database Procedures
• To read data from DataStore objects, the entire key must be provided • User ID which is registered as developer and has
• Near-line storage (NLS) connections are not supported proper authorizations

IBM Proprietary | © 2017 IBM Corporation 3


Code pushdown

An ABAP based BW For the HANA based BW


transformation loads the data transformation the entire
package by package from the transformation logic is transformed into
source database objects into the a CalculationScenario.
memory of the Application Server This CalcScenario is embedded into a
(ABAP) for further processing. The ColumnView. To select data from the
BW transformation logic is source object, the DTP creates a SQL
executed inside the Application SELECT statement based on this
Server (ABAP) and the transformed ColumnView and the processing logic of
data packages are shipped back to the CalcScenario applies all
the Database Server. The Database transformation rules (defined in the BW
Server writes the resulting data transformation) to the selected source
packages into the target database data. By shifting the transformation
object. Therefore, the data is logic into the CalcScenario, the data can
transmitted twice between be transferred directly from the source
database and application server. object to the target object within a
During processing of an ABAP single processing step. Technically this is
based BW transformation, the implemented as an INSERT AS SELECT
source data package is processed statement that reads from the
row by row (row-based). The ABAP ColumnView and inserts into the target
based processing allows to define database object of the BW
field-based rules, which are transformation. This eliminates the data
processed as sequential processing transfer between Database Server and
steps. Application Server (ABAP). The
complete processing takes place in SAP
HANA. 

IBM Proprietary | © 2017 IBM Corporation 4


BW routine using AMDP
Initially both execution
modes (1), ABAP and HANA,
are possible (unless you are
using a feature which
The dialog (2) will only prevents a push down). The
come up for the first implementation type
routine within a BW decision for the first routine
transformation. If you within a BW transformation
choose ABAP routine for sets the implementation
the first routine the type for all further routines
Runtime Status will within this BW
change from ABAP and transformation.
HANA runtime are
supported to Only ABAP
runtime is supported (3).

If you choose AMDP script for


the first routine the Runtime
Status changes to Only HANA
runtime is supported (4)

IBM Proprietary | © 2017 IBM Corporation 5


BW routine using AMDP – Step by Step
• Open the embedded SAP GUI

• 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.

IBM Proprietary | © 2017 IBM Corporation 6


The AMDP Class

The BW transformation framework generates an ABAP class with a method


called PROCEDURE. The class implements the ABAP Managed Database
Procedure (AMDP) marker interface IF_AMDP_MARKER_HDB. The interface
marks the ABAP class as an AMDP class. A method of an AMDP class can be
written as a database procedure. Therefore the BW transformation framework
creates a HANA specific database procedure declaration for the method
PROCEDURE

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.

IBM Proprietary | © 2017 IBM Corporation 7


Feature list that prevents a push down
The official SAP Help provides a small feature list which prevents a HANA execution. Here are a more detailed list:
• Queries as InfoProvider are not supported as the source
• ABAP Start-, End- and Field-Routines 
• With BW 7.50 SP04 corresponding SQL Script routines are supported
• Formula elements that prevents a push down
• DATECONV, WEEK_TO_1ST_DAY, FISCPER_CALMONTH, CALMONTH_FISCPER, CONDENSE, ABORT_PACKAGE,  SKIP_RECORD, SKIP_RECORD_AS_ERROR
• LOG_MESSAGE
• Customer created formulas (BAdI RSAR_CONNECTOR)
• Transfer routine (Characteristic- / InfoObject – Routine) are not supported
• 0SOURSYSTEM and 0LOGSYS are supported
• Rule type TIME (Time Characteristic) with Time Distribution are not supported
• Rule groups are not supported
• InfoObject with time-dependent Attributes are not supported as source and as target
• Supported with BW 7.50 SP04
• Cube like DataStore Objects (advanced) are not supported as target
• Supported with BW 7.50 SP04
• DataStore Objects (advanced) with non-cumulative key figure(s) are not supported as target
• Supported with BW 7.50 SP04
• To read data from DataStore objects, the entire key must be provided
• Near-line connections
• Supported with BW 7.50 SP04
• DTP Options
• Error Handling not supported
• Supported with BW 7.50 SP04
• Semantic Groups 
Further information about supported SAP HANA execution feature are provided in the SAP note:
2329819 – SAP HANA execution in DTPs (Data Transfer Processes) – Optimizations.

IBM Proprietary | © 2017 IBM Corporation 8


Sample code

IBM Proprietary | © 2017 IBM Corporation 9


Debugging

• To use the AMDP debugger open the BW transformation


with the SAP HANA Script. It is necessary to use the embed
version of the Data Warehousing Workbench (RSA1) within
the Modeling Tools for SAP BW powered by SAP HANA.
• An AMDP breakpoint can added by double clicking to the
left of the line number. For each AMDP breakpoint a dot will
be created. In case the AMDP debugger is active the dot will
be green and the tooltip also provides information about
the AMDP debugger status. In case the AMDP debugger is
not active the dot is gray and the AMDP debugger can be
activated by double clicking the gray dot.
• To start the AMDP debugger it is necessary to execute the
DTP in the processing mode Parallel SAP HANA Execution,
see (1) in Figure below. Do not run the DTP in the simulation
mode! The DTP simulation mode for a BW transformation
will not execute the generated SQL statements.
• If the process is caught by the AMDP debugger the popup
dialog, see (2) in Figure, Confirm Perspective Switch will be
appear. If you confirm the dialog the IDE switches to the
debug perspective

IBM Proprietary | © 2017 IBM Corporation 10


Debugging contd..

The debugging is in process now. (1) shows the


call stack, (2) shows the procedure source code,
(3) provides an overview of the available
variables from the procedure and (4) shows a
data preview.

IBM Proprietary | © 2017 IBM Corporation 11


HANA exit variables

• Use BADI RSROA_VARIABLES_HANA_EXIT


• Create new implementation
• Write AMDP script in method IF_RSROA_VAR_HANA_EXIT~PROCESS

Sample Code -

IBM Proprietary | © 2017 IBM Corporation 12


General recommendations

• 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.

IBM Proprietary | © 2017 IBM Corporation 13


References

Torsten Kessler’s blog –


https://blogs.sap.com/2016/05/24/hana-based-bw-transformation/

First Guidance from SAP –


https://www.sap.com/documents/2016/06/745031b8-757c-0010-82c7-eda71af511fa.html

IBM Proprietary | © 2017 IBM Corporation 14

You might also like