SAP

15
Date:9.7.2014 Author: TIP Core AS&VM PS IMS NW ABAP Perforce version 21 Boosting ERP applications with the SAP Business Application Accelerator powered by HANA Customer Guide

description

SAP

Transcript of SAP

Page 1: SAP

Date:9.7.2014

Author:

TIP Core AS&VM PS IMS NW ABAP

Perforce version 21

Boosting ERP applications with the SAP Business Application Accelerator powered by HANA

Customer Guide

SAP Net

Weaver

Foundation - Internationalizati

on

Page 2: SAP

Contents

1 Introduction .................................................................................................................... 4

2 Concept .......................................................................................................................... 5

2.1 Redirected Operations ............................................................................................................................... 5

2.1.1 Statements ............................................................................................................................................... 5

2.1.2 Source ...................................................................................................................................................... 5

2.2 Context Definition ....................................................................................................................................... 5

2.3 Context Evaluation at Runtime ................................................................................................................. 6

3 Using the SAP Business Application Accelerator ...................................................... 6

3.1 Installation ................................................................................................................................................... 6

3.2 General Activation ...................................................................................................................................... 7

3.3 Loading Scenarios ..................................................................................................................................... 7

3.3.1 Predefined SAP Scenarios ...................................................................................................................... 7

3.3.2 Custom Scenarios ................................................................................................................................. 10

3.4 Trouble Shooting ...................................................................................................................................... 12

3.4.1 Redirection Does Not Work ................................................................................................................... 12

3.4.2 Dump when reading from the secondary database connection ............................................................ 13

3.4.3 Performance Does Not Improve ............................................................................................................ 13

3.4.4 Implicit Assumptions about Sorting Order ............................................................................................. 13

Appendix A: Documentation of Profile Parameter rsdb/rda ...................................................................... 14

Page 3: SAP
Page 4: SAP

1 Introduction

In order to leverage the performance advantage of the SAP HANA database for existing ERP customers without changing existing ERP applications the SAP Business Application Accelerator powered by HANA provides a possibility to run applications in a way, that data from performance critical tables is read from a SAP HANA database containing replicated data. The main performance improvement gained in this setup stems from the fact that in the SAP HANA database tables are completely buffered in memory whereas you don’t necessarily have full buffering on the original database.

This setup is interesting for many reporting-type applications which are able to work with replicated data, data that has naturally a slight time delay compared with the original data and that does not have transactional consistence.

Parallel to the ERP system the SAP Business Application Accelerator powered by HANA - a SAP HANA database together with an instrumented application server - is installed. A well defined set of tables is replicated continuously to the SAP HANA database. The instrumented application server is able to run the ERP applications without modifications. It executes read and write operations on the main database. Only for certain scenarios it reads data from replicated tables on the SAP HANA database via a secondary database connection and not from the main database:

Scenarios are specified by defining the context in which data is to be read from the SAP HANA database.

The context can be defined by the combination of the parameters:

Tables / DB Views

Main program

Batch job name

Page 5: SAP

2 Concept

2.1 Redirected Operations

2.1.1 Statements

The SAP Business Application Accelerator allows redirection of database queries to a secondary database connection.

Redirected queries are:

SELECT

OPEN CURSOR … FETCH

Not redirected are the following queries:

Queries with CONNECTION addition

SELECT … FOR UPDATE

Queries prepared with OPEN CURSOR WITH HOLD

2.1.2 Source

Allowed sources for query redirection are:

Transparent tables

Cluster tables1

Database views in case all base tables are replicated

No redirection takes place on the following sources:

Pool tables2

Table pools

Table clusters

If queries are running on several tables the secondary connection is used, if for all involved tables a redirection via the same secondary database connection is switched on.

2.2 Context Definition

The context in which the secondary database should be used is defined with the following parameters:

TABNAME Name of a table or view for which queries should be redirected to the SAP HANA database.

MAINPROG Name of a main program (calling program, SY-CPROG) in which queries should be redirected to the SAP HANA database

3.

1 Cluster tables become transparent during replication to the SAP HANA database

2 If pool tables need to be redirected please convert them into transparent tables on the main database

3 Please note that the ABAP statement SUBMIT sets a new main program.

Page 6: SAP

JOBNAME Name of a batch job4 for which queries should be redirected to the SAP HANA database.

A scenario is defined by a set of context information.

2.3 Context Evaluation at Runtime

During runtime the context of every query is evaluated and compared with the context definitions for the different scenarios.

If a query on <tabname> takes place in the main program <mainprog> (value of SY-CPROG) running in a batch job with name <jobname> a redirection to the SAP HANA database takes place if:

a) there is a scenario context with TABNAME = <tabname> MAINPROG = ‘ ’ JOBNAME = ‘ ’

b) or there is a scenario context with TABNAME = <tabname> MAINPROG = <mainprog> JOBNAME = ‘ ‘

c) or there is a scenario context with TABNAME = <tabname> MAINPROG = <mainprog> JOBNAME = <jobname>

4

If the selected connection does not exist or if the connection is temporarily not available a runtime error is thrown.

3 Using the SAP Business Application Accelerator

3.1 Installation

In order to install the SAP Business Application Accelerator you need kernel version 7.21 (SAP Note 1713986 and 1716826) or newer (e.g. kernel 7.40) and the SAP Business Application Accelerator Add On (SWT2DB, SAP Note 1696402).

Please install the kernel on all application servers of your system.

Install the SAP Business Application Accelerator Add On in your system.

Remark: Early version of the Kernel 7.40 and 7.41 contained an error so that the redirection did not work. Please use the following minimal patch levels (see SAP Note 1949508):

7.40: Kernel Patch level 47 7.41: Kernel Patch level 13

4 After implementation of SAP Note 1716742 it is also possible to specify batch job name patterns with a

wild card at the end of the pattern.

Page 7: SAP

3.2 General Activation

Enable the SAP Business Application Accelerator on all servers (recommended) or on dedicated application servers by setting the following profile parameter:

rsdb/rda = on

The parameter is defined and documented5 in transaction RZ11 and dynamically switchable during

runtime.

In case the SAP Business Application Accelerator is enabled only on dedicated servers, users of the SAP Business Application Accelerator need to logon to this server (best via logon groups).

3.3 Loading Scenarios

3.3.1 Predefined SAP Scenarios

Scenarios for the SAP Business Application Accelerator identified by SAP are delivered via specific SAP notes

6. Attached to the notes you will find an XML file which contains the scenario definition used as input

for the following steps.

3.3.1.1 Upload Scenario

Upload the scenario definition with report RDA_MAINTAIN. Specify the location of the scenario file, choose “Upload Scenario” and execute the report:

5 In release SAP_BASIS 7.31 or newer the profile parameter documentation is not available in transaction

RZ11, as the SAP Business Application Accelerator Add On is developed in release 7.00 and the documentation repository has changed in release 7.31. For your reference you find the documentation in Appendix A: Documentation of Profile Parameter rsdb/rda 6 Dedicated scenarios may also be delivered as plug-ins to the ERP Accelerator Customizing (HDBC).

How to install and activate them is described there.

Page 8: SAP

3.3.1.2 Replicate tables via SLT to the connected SAP HANA Database

Use transaction SE16 to select from table RDA_CONTEXT the list of all tables and views that are part of the scenario.

Take care, that all tables / views that are part of the scenario are created on the SAP HANA database and start the replication for those tables.

Information about SLT data replication tools can be found at:

SLT Installation Guide: http://service.sap.com/~sapidb/011000358700000604912011

Security Guide: http://help.sap.com/hana/hana1_slt_repli_sec_en.pdf

Technical Operations Manual: http://help.sap.com/hana/hana_slt_tom_en.pdf

3.3.1.3 Setup Secondary Database Connection

The SAP Business Application Accelerator needs a secondary database connection to access the SAP HANA database.

You can either reuse the database connection that has been set up for the SLT data replication or you can create a new secondary database connection.

How to set up a secondary connection to HANA is described in SAP Note 1597627 .

Please note that the DBSL needed for a secondary database connection to a SAP HANA database is available only for kernel release 7.20 onwards.

The table DBCON holding the names of secondary database connections can be maintained with transaction DBACOCKPIT.

3.3.1.4 Set Secondary Database Connection for Scenario

Use report RDA_MAINTAIN to set the secondary database connection for the scenario. Select “Maintain Database Connection”, specify the scenario name, the name of the secondary database connection from section 3.3.1.3 and execute the report:

Page 9: SAP

3.3.1.5 Activate Scenario

Use report RDA_MAINTAIN to activate the scenario. Select “Activate Scenario”, specify the scenario name and execute the report.

Page 10: SAP

3.3.2 Custom Scenarios

This section describes how you can build and use scenarios for your own development.

3.3.2.1 Prerequisites / Limitations

Before using the SAP Business Application Accelerator you have to check if your application qualifies for this setup. The following points have to be considered:

Replicated data may not be complete as the replication of data takes some time.

Replicated data is not consistent. Objects are often spread over multiple tables. Replication does not guarantee consistent transfer of data from multiple tables.

SAP HANA database may contain data that is not available in the source database, for example if SLT replication is configured in a way that prevents archive deletes from being replicated to the target system.

If a participating application changes content in one of the tables that are replicated, it does not see the changes (unless the replication is very fast). The reason is that the changes are done on the main database and not in the SAP HANA database.

If data is read from joins or sub-selects where the base tables are not all replicated to the same secondary connection, the data is read from the main database.

In some cases it may be difficult to find a sufficiently closed set of tables that need to be read from the SAP HANA database.

When specifying a main program to narrow down the context please check, that the queries you want to redirect really run in the context of the main program. Particularly the SUBMIT statement results in a new main program.

In RFC calls the main program SY-CPROG is always set to SAPMSSY1. Accordingly you cannot use the main program to narrow down the context in such situations.

7

In Web Dynpro applications the main program SY-CPROG is always set to SAPMHTTP. Accordingly you cannot use the main program to narrow down the context in such situations.

8

3.3.2.2 Define Custom Scenarios

For your custom scenario you need to choose a scenario name in the namespace Z*. In the following example this is Z_MYSCENARIO.

Define the context of your scenario by collecting a set of ( table / main program / job name ) triples as described in section 2.2 .

Please note that all main programs need to be in customer namespace. If no main program is specified the table needs to be in customer namespace.

Custom scenarios must not operate on SAP programs! Custom scenarios that affect SAP programs are regarded as modifications and will not be supported by SAP.

Once you have your list complete please bring it into an XML format as shown in the following example:

7 As workaround for this limitation it is suggested to wrap the table in question in a projection view which

allows you to give the query a unique identity. This is certainly only possible if the query is located in a program in customer namespace. 8 Same as footnote above.

Page 11: SAP

<?xml version="1.0" encoding="utf-8"?>

<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml"> <asx:values>

<FORMAT_VERSION>1</FORMAT_VERSION>

<SCENARIO>

<NAME>Z_MYSCENARIO</NAME>

<VERSION>24</VERSION>

<DESCRIPTION>MyScenario5</DESCRIPTION>

<CONTEXT>

<item>

<TABNAME>TAB1</TABNAME>

<MAINPROG>ZMAIN1</MAINPROG>

<JOBNAME></JOBNAME>

</item>

<item>

<TABNAME>TAB2</TABNAME>

<MAINPROG>ZMAIN2</MAINPROG>

<JOBNAME></JOBNAME>

</item>

<item>

<TABNAME>TAB3</TABNAME>

<MAINPROG>ZMAIN3</MAINPROG>

<JOBNAME>MYJOBNAME</JOBNAME>

</item>

</CONTEXT>

</SCENARIO>

</asx:values>

</asx:abap>

Remarks:

Please use capital letters for all entries. Only the scenario description may contain small letters.

In case the parameters ( table / main program / job name ) are not sufficient to specify exactly the queries that should be redirected to the SAP HANA Database the SAP Business Application Accelerator cannot be used for your case.

3.3.2.3 Loading Custom Scenarios

Once your scenario definition is ready and available in XML format you can upload and use it in the same way as an SAP defined scenario. Please proceed with the upload step described in section 3.3.1.1.

Page 12: SAP

3.3.2.1 Checking Custom Scenarios

Verify if your scenarios work as expected by looking with transaction ST05 at SQL traces:

Are all queries redirected to the SAP HANA Database you wanted to be redirected?

Are all queries you do not want to be redirected still executed on the main database?

3.4 Trouble Shooting

3.4.1 Redirection Does Not Work

If a query on table MYTABLE in report MYREPORT is not executed via secondary connection MYCONNECTION although a redirection with the SAP Business Application Accelerator is intended please check the following points:

a) Is the profile parameter set on your application server?

Use report RSPFPAR to check, if the current value on your server is rsdb/rda = on

b) Is your scenario active?

Use transaction SE16 and check, if the status of your scenario MYSCENARIO is set to 'A' in table RDA_CONTROL.

c) Is the RDA runtime information consistent?

Run report RDA_MAINTAIN and press button "Check RDA runtime information (CTRL+F1)" to check and repair the runtime information.

d) Is MYTABLE part of the scenario?

Check with transaction SE16, if MYTABLE shows up in table RDA_CONTEXT for scenario MYSCENARIO.

e) Does the context for MYTABLE cover main program MYPROGRAM?

Use transaction SE16 to display the content of view RDA_CONFIG. Check if you have either an entry with tabname = MYTABLE and empty main program or an entry with tabname = MYTABLE and main program = MYPROGRAM.

f) Is MYPROGRAM really the calling program?

Please set a breakpoint at the query in question, run your application, stop at the breakpoint and check if SY-CPROG = MYPROGRAM. In case you don’t want to debug, but have an SQL trace (transaction ST05) you can as a first check have a look at the call stack (in the trace list mark one line and display the call stack with Goto Display Call stack ).

g) Does the query involve several tables?

Run a SQL trace of your application (transaction ST05). Display the SQL trace, find the query in question and double click on the statement to check the query. If it is a join over multiple tables make sure, that all of them are part of the scenario MYSCENARIO. Otherwise the query is executed on the main database.

h) Is the query defined via OPEN CURSOR WITH HOLD?

Queries that use the feature WITH HOLD are always executed on the main database.

i) Does the query contain a CONNECTION statement pointing to a different data base?

The database connection specified with an explicit CONNECTION statement is always used.

Page 13: SAP

j) Early version of the Kernel 7.40 and 7.41 contained an error so that the redirection did not work. Are you using the following minimal patch levels (see SAP Note 1949508)? 7.40: Kernel Patch level 47 7.41: Kernel Patch level 13

3.4.2 Dump when reading from the secondary database connection

A query is redirected to the secondary database connection but the execution of the query aborts with a shortdump (DBIF_RSQL_INVALID_RSQL). Several different root causes are possible:

a) The SAP DBSL for the SAP HANA database is missing on the application server. You can find in the error analysis section of the short dump an entry like: Component............ "DL (Dynamic Loader)"

Place................ "SAP-Server <server_name> on host <host_name> (wp <work process id>)"

Dependent module libSQLDBCHDB.so could not be loaded.

Please check SAP Note 1597627 for a proper setup of the secondary database connection.

b) The table to be read does not exist on the target database or the structure of the table does not match between primary and secondary data base.

Please make sure, that all needed tables are replicated to the secondary data base. Adapt the replicated tables in case of structure changes on the primary data base.

3.4.3 Performance Does Not Improve

If the redirection is working correctly but no significant performance improvement can be observed for your application, please check the following points:

a) Significant performance improvements are expected only, if the unaccelerated application spends most of the execution time in database queries. Please check and compare ABAP and DB times of your application.

b) Significant performance improvements are expected only, if the queries to be accelerated spend a considerable amount of time in IO Operations (i.e. disc reads). Please check the disc read times of the queries. This check needs to be done in the productive environment. Remark: Especially in isolated test systems with small transactional load the caching mechanisms of standard databases lead to a performance gain of the main database that does not exist in the productive system. This makes it difficult to conduct meaningful performance comparisons in a test system.

c) Not every query is per se faster on the SAP HANA database.

If you are not sure, if your application is a candidate for an acceleration with HANA please ask your AGS contact for the new service “HANA Feasibility Check”.

3.4.4 Implicit Assumptions about Sorting Order

If you have queries without an ORDER BY statement it is possible that on your current database implicitly data was returned in a certain sorting order. The sorting order on HANA might be different (but still compliant with SQL as no ORDER BY is used). In case you rely on this implicit sorting order your application logic might no longer work.

There are check tools to search for such places. Please refer to SAP Note 1785057 section “Check assumptions regarding implicit sorting during access to transparent tables” and “Check assumptions regarding implicit sorting during access to former pool and cluster tables” for details.

Page 14: SAP

Appendix A: Documentation of Profile Parameter rsdb/rda

Parameter: rsdb/rda

Short description: Switch for SAP Business Application

Accelerator

Activate/Deactivate Redirect Database Access (RDA)

Parameter description:

This parameter is used to activate and deactivate RDA within the database

interface. Depending on the setting of this parameter, certain Open SQL

SELECT statements are executed against a remote database via a secondary

connection. As a pre-condition the content of the selected table must be

replicated on the remote database and the table must be configured in the

buffered database view RDA_CONFIG. A configuration of a table in RDA_CONFIG

can include a context (main program name and batch job name) as a constraint

and specifies a logical connection name of the remote database. The selected

content of the remote database could be different from the table's content on

the default database depending on the used replication mechanism.

For more information see the documentation for class CL_RDA_UTILITIES.

The parameter value can be changed dynamically.

OFF: RDA is deactivated.

ON: RDA is activated. Open SQL SELECT statements on tables

configured in the database view RDA_CONFIG are redirected.

The configured context of the involved tables is considered.

A redirect is not performed for the following statements:

o SELECT SINGLE FOR UPDATE

o OPEN CURSOR WITH HOLD

o SELECT statements on physical pool, logical pool and

physical cluster tables

o Statements with CONNECTION addition

Application area: Database

Unit:

Default value:

OFF

Person(s) allowed to make changes:

Page 15: SAP

SAP support only

Limitations for the operating systems:

Limitations for database systems:

Are other parameters affected or dependent:

Valid entries, formats, areas:

ON, OFF