Transcript
Page 1: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

SAP How-to GuideDatabase & Technology – SAP NetWeaver Business Warehouse

SAP HANA™ Appliance

Applicable Releases:

SAP HANA 1.0 SPS 05

SAP NetWeaver Business Warehouse 7.3x

Version 1.0

June 2013

How to Consume SAP HANA Models in SAP NetWeaverBW from Remote HANA Instances

Page 2: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

© Copyright 2013 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form

or for any purpose without the express permission of SAP AG. The

information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors

contain proprietary software components of other software vendors.

Microsoft, Windows, Excel, Outlook, and PowerPoint are registered

trademarks of Microsoft Corporation.

IBM, DB2, DB2 Universal Database, System i, System i5, System p,

System p5, System x, System z, System z10, System z9, z10, z9, iSeries,

pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390,

OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power

Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER,

OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS,

HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex,

MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and

Informix are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the U.S. and other

countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either

trademarks or registered trademarks of Adobe Systems Incorporated in

the United States and/or other countries.

Oracle is a registered trademark of Oracle Corporation.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open

Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame,

and MultiWin are trademarks or registered trademarks of Citrix Systems,

Inc.

HTML, XML, XHTML and W3C are trademarks or registered trademarks

of W3C®, World Wide Web Consortium, Massachusetts Institute of

Technology.

Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used

under license for technology invented and implemented by Netscape.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP

BusinessObjects Explorer, StreamWork, and other SAP products and

services mentioned herein as well as their respective logos are

trademarks or registered trademarks of SAP AG in Germany and other

countries.

Business Objects and the Business Objects logo, BusinessObjects,

Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other

Business Objects products and services mentioned herein as well as their

respective logos are trademarks or registered trademarks of Business

Objects Software Ltd. Business Objects is an SAP company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere,

and other Sybase products and services mentioned herein as well as their

respective logos are trademarks or registered trademarks of Sybase, Inc.

Sybase is an SAP company.

All other product and service names mentioned are the trademarks of

their respective companies. Data contained in this document serves

informational purposes only. National product specifications may vary.

The information in this document is proprietary to SAP. No part of this

document may be reproduced, copied, or transmitted in any form or for

any purpose without the express prior written permission of SAP AG.

This document is a preliminary version and not subject to your license

agreement or any other agreement with SAP. This document contains

only intended strategies, developments, and functionalities of the SAP®

product and is not intended to be binding upon SAP to any particular

course of business, product strategy, and/or development. Please note

that this document is subject to change and may be changed by SAP at

any time without notice.

SAP assumes no responsibility for errors or omissions in this document.

SAP does not warrant the accuracy or completeness of the information,

text, graphics, links, or other items contained within this material. This

document is provided without a warranty of any kind, either express or

implied, including but not limited to the implied warranties of

merchantability, fitness for a particular purpose, or non-infringement.

SAP shall have no liability for damages of any kind including without

limitation direct, special, indirect, or consequential damages that may

result from the use of these materials. This limitation shall not apply in

cases of intent or gross negligence.

The statutory liability for personal injury and defective products is not

affected. SAP has no control over the information that you may access

through the use of hot links contained in these materials and does not

endorse your use of third-party Web pages nor provide any warranty

whatsoever relating to third-party Web pages.

SAP “How-to” Guides are intended to simplify the product implement-

tation. While specific product features and procedures typically are

explained in a practical business context, it is not implied that those

features and procedures are the only approach in solving a specific

business problem using SAP NetWeaver. Should you wish to receive

additional information, clarification or support, please refer to SAP

Consulting.

Any software coding and/or code lines / strings (“Code”) included in this

documentation are only examples and are not intended to be used in a

productive system environment. The Code is only intended better explain

and visualize the syntax and phrasing rules of certain coding. SAP does

not warrant the correctness and completeness of the Code given herein,

and SAP shall not be liable for errors or damages caused by the usage of

the Code, except if such damages were caused by SAP intentionally or

grossly negligent.

Disclaimer

Some components of this product are based on Java™. Any code change

in these components may cause unpredictable and severe malfunctions

and is therefore expressively prohibited, as is any decompilation of these

components.

Any Java™ Source Code delivered with this product is only to be used by

SAP’s Support Services and may not be modified or altered in any way.

Page 3: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

Document HistoryDocument Version Description

1.00 First official release of this guide

Page 4: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

Typographic ConventionsType Style Description

Example Text Words or characters quotedfrom the screen. Theseinclude field names, screentitles, pushbuttons labels,menu names, menu paths,and menu options.Cross-references to otherdocumentation

Example text Emphasized words orphrases in body text, graphictitles, and table titles

Example text File and directory names andtheir paths, messages,names of variables andparameters, source text, andnames of installation,upgrade and database tools.

Example text User entry texts. These arewords or characters that youenter in the system exactlyas they appear in thedocumentation.

<Exampletext>

Variable user entry. Anglebrackets indicate that youreplace these words andcharacters with appropriateentries to make entries in thesystem.

EXAMPLE TEXT Keys on the keyboard, forexample, F2 or ENTER.

IconsIcon Description

Caution

Note or Important

Example

Recommendation or Tip

Page 5: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

Table of Contents

1. Business Scenario ............................................................................................................ 1

2. Background Information .................................................................................................. 22.1 VirtualProvider based on DTP ......................................................................................... 22.2 VirtualProvider with Function Module ............................................................................ 32.3 Considerations.................................................................................................................. 5

3. Prerequisites ................................................................................................................... 6

4. Scenarios for VirtualProvider ...........................................................................................74.1 Create DBCON and Source System ............................................................................... 74.2 Scenario: VirtualProvider based on DTP ....................................................................... 7

4.2.1 Create Logical system for the DBCON entry ................................................... 74.2.2 Create DB Connect Source System .................................................................. 84.2.3 Create VirtualProvider based on DTP ............................................................... 84.2.4 Create DataSource for the HANA DB Connect source system...................... 84.2.5 Create Transformation and DTP for the VirtualProvider .............................. 10

4.3 Scenario: VirtualProvider with Function Module ........................................................ 104.3.1 Create Mapping Tables..................................................................................... 104.3.2 Create user-defined Function Module .............................................................124.3.3 Create VirtualProvider with FM ....................................................................... 13

4.4 Create Query ................................................................................................................... 14

5. Data loading for HANA Views via Operational Data Providers ........................................ 145.1 Create ODP Source system........................................................................................... 145.2 Create ODP DataSource on SAP HANA View ...............................................................15

6. Appendix ........................................................................................................................ 18

Page 6: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 1

1. Business Scenario

An important part of the whole BW-HANA interoperability is the option to create scenarios wheredata owned and modeled within BW and data owned and modeled within native HANA data martsinteract. This is what we call mixed scenarios. The interaction can happen in both directions, fromHANA to BW and vice-versa, and there are options to physically move the data or to virtuallyexpose the data (see: http://www.saphana.com/docs/DOC-3151).Leveraging the integration between BW and HANA is well described in the case when BW is actuallyrunning on the SAP HANA database (SAP BW powered by SAP HANA). For details visit the onlinedocumentation Virtual Data Mart Layer (TransientProviders and VirtualProviders on HANA model),or the SAP HANA Developer Guide (section 7.6 for importing BW objects).

The following solutions are available for consuming data in BW from a remote HANA instance(HANA DataMart / accelerator, Suite-on-HANA, BW-on-HANA, etc.):

Load the data into BW via DB Connect or Operational Data Provisioning (ODP), orAccess the data via VirtualProvider (direct access without loading data into BW)

In this paper we mainly focus on the use case when BW consumes the data/models of a remoteSAP HANA system without loading the data into BW (modeling options for direct access):

BW and HANA are two separate systemsIt is not required for BW to run on HANA, could be any BW 7.x release with any DBSAP HANA is typically a DataMart scenario with no ABAP stack (standalone/native HANA)Consume the HANA data and models within BW via VirtualProviderThe data is stored and modeled in the remote HANA system and not loaded to BWHANA models can be Analytic, Calculation or Attribute view.

The two solutions we will discuss in this paper are:...

1. VirtualProvider based on Data Transfer Process (DTP)2. VirtualProvider with Function Module

For general information please visit the online documentation: Modeling Direct Data Access (BWVirtualProvider scenarios)

RecommendationWhile BW on HANA is not required for the scenarios discussed in this paper, BW onHANA offers many advantages and capabilities within the Real-time Data PlatformReal-time Data Warehousing with SAP LT Replication Server (SLT) for SAP NetWeaverBWAnalytics Powered by SAP HANA and SAP NetWeaver BW

At the end we will briefly discuss the Operational Data Providers to load data to BW from HANA viaHANA modeling views.

Page 7: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 2

2. Background Information

Both VirtualProvider scenarios require the secondary DB connection to the “remote” SAP HANAdatabase. In order to use DB Connect the Database Shared Library (DBSL) - must be installed forthe corresponding source database management system on the BW application server (visit thecorresponding online documentation: Transferring Data Using DB Connect and Installing theDatabase Shared Library (DBSL) )For specifics and prerequisites visit SAP Note 1597627 - SAP HANA connection

The general DB Connect recommendations, prerequisites and restrictions apply as well:Transferring Data Using DB Connect

CAUTIONUsing HANA models (views) be aware of the definition of those models and the outputthey provide – the design of the model (join definitions, filters, restrictions, calculatedmeasures / attributes / columns, variables, input parameters, etc. ) influence theoutput and the performance. Please consider the recommendations and bestpractices regarding modeling in SAP HANA.

2.1 VirtualProvider based on DTPThe solution is based on the standard DB Connect architecture and requires a DB Connect sourcesystem to the remote HANA and a data source based on a table stored in HANA or a Calculationview from the HANA system.

ImportantHANA Analytic views are not supported for DB Connect – the standard DBConnect data source does not assemble the required ‘GROUP BY’ for the SQLstatement, therefore HANA can’t process the SELECT statement.The DB connect user needs to have appropriate access and privileges in HANA inorder to read the metadata and to process SQLThe following restrictions apply for the technical name of the HANA sourcetables/views:

Only upper case letters, numbers, “_” (underscore) and “/” (slash)Total length must not exceed 30 charactersSAP HANA does allow both upper/lower case letters in the technicalnames of packages and models – these are not available for DB Connectdata source (e.g. package/CALC_VIEW is not possible, should bePACKAGE/CALC_VIEW).

For details please visit the online documentation: Creating VirtualProviders Based on DTP

Page 8: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 3

NoteDB Connect DataSource can be used for loading the data into BW – this option will notbe discussed in this paper.

2.2 VirtualProvider with Function ModuleThis solution offers more flexibility, but also requires a higher implementation effort. For generalinformation please visit the online documentation: Creating VirtualProviders with Function Modules

NoteThe solution does NOT replace best practices for BI data modeling and provideslimited means for performance tuning (DB indexes). If you want to report on high datavolumes, the data should be loaded into standard InfoCubes or DataStore objects.

This solution is based on the function module RSDRI_VPROV_READ_TEMPLATE with the followinginterface:

The documentation of the function module can be found in the BW system itself (SE24).The general description of the interfaces can be found here: Description of the Interfaces

The user-defined function module leverages the ADBC (ABAP Database Connectivity) APIframework for HANA native SQL using the CL_SQL* service classes. In this example we do not usethe class CL_RSDRV_EXTERNAL_IPROV_SRV (it contains services for implementing a localInfoProvider without SID support that is based on a database table) - see ABAP/HANA Connectivityvia Secondary Database Connection - ADBC is preferred over other options because of its flexibility(e.g. package size) and error handling.

When the user-defined function module is called, the BW Data Manager passes down the requiredparameters (list of characteristics, key figures, selections and restrictions).

Page 9: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 4

The basic program logic:assemble the SQL statement specifically required for HANA

create the field list for the SELECT from the I_TH_SFCcreate the GROUP BY list from I_TH_SFCcreate the aggregation fields from I_TH_SFKcreate the WHERE clause from I_T_RANGE

assign DB Connection, e.g. cl_sql_connection=>get_connection()create SQL statement, e.g. cl_sql_connection=>create_statement()execute SQL statement, e.g. cl_sql_statement=>execute_query()process the result set and pass the data to the interface (e_t_data)pass the potential messages to e_t_msg

Two user-defined configuration tables need to be maintained in order to translate between BW andHANA (via SM30).

Mapping: VirtualProvider to HANA Model/Table

Enter the HANA schema and model (or table) – please note that HANA model views arestored under the _SYS_BIC schema. Select the View Type. For HANA tables leave the ViewType field blank.

Page 10: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 5

Mapping: InfoObjects to HANA Model Fields

Maintain the mapping – the table allows global and InfoProvider specific mapping for eachInfoObject. In the function module the InfoProvider specific mapping overrides the genericmapping. The table also allows entering constant value that can be used in case the returnvalue from HANA is blank (e.g. the table/model does not have the corresponding field.

2.3 ConsiderationsBoth approaches enable the BW system to consume information models, tables from a remote SAPHANA instance. The following considerations help to choose the right solution:

Performance: both solution is based on the DB Connect architecture, therefore offerscomparable performance. The performance depends on the complexity of the HANA model(see best practices for HANA modeling).The DB Connect Datasource and DTP allow accessing raw tables or calculation views only – noGROUP BY is generated when the DB Connect generates the SQL statement, therefore noAnalytic views can be leveraged

TipConsider creating Calculation views on top of Analytic Views

VirtualProvider with function module requires more development effort and the maintenance ofthe mappings, but provides a flexible solution with no restrictions of accessing the differentHANA information models, stored procedures.

Page 11: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 6

VirtualProvider Why would you choose it? What to consider against it?

Based on DTP (DB Connectdatasource to HANA)

Simple, standarddevelopment effort

Analytic views, storedprocedures not supported

Function Module No restriction onconsumable HANA modeltypes

Development effortMaintain mappings

ImportantNone of the solution is automatically synchronized with changes in HANA – changesto HANA models need to be adopted manually in BW.

3. Prerequisites

SoftwareSAP NetWeaver Business Warehouse 7.x (on any DB), latest SP recommendedSAP HANA 1.0, latest revision recommended

SAP HANA Client is installed on each ABAP Application Server. ABAP Application ServerOperating System must support the HANA Client (check Platform Availability Matrix forsupported operating systems).SAP HANA DBSL is installed (this is the Database specific library which is part of the ABAPKernel)The SAP HANA DBSL is only available for the ABAP Kernel 7.20 Kernel 7.20 is already thekernel for NetWeaver 7.02, 7.03, 7.20, 7.30 and 7.31

Kernel 7.20 is backward compatible and can also be applied to NetWeaver 7.00, 7.01,7.10, and 7.11

Your ABAP system must be Unicode or Single Code Page 1100 (Latin 1/ISO-8850-1) -SeeSAP Note 1700052 for non-Unicode Support instructions

Relevant SAP NotesSAP Note 1597627 - SAP HANA connectionAdditional background/starting documentation (also provide a link)Modeling Direct Data Access (BW VirtualProvider scenarios)Required/recommended expertise or prior knowledgeSAP BW modeling with VirtualProvidersSAP HANA Modeling

Page 12: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 7

4. Scenarios for VirtualProvider

This section provides a high-level overview about the steps that need to be performed – the detailsof how to create BW objects won’t be discussed here (see the online documentation for details).

As described above there are two options for direct access:VirtualProvider based on Data Transfer Process (DTP)VirtualProvider with Function Module

Both scenarios require the secondary database connection to the remote HANA system.

4.1 Create DBCON and Source SystemCreate/maintain the required DB connection parameters....

Transaction SM30 DBCONEnter the parameters for the HANA DB connection:

DBCON can also be maintained via transaction DBACOCKPIT.

4.2 Scenario: VirtualProvider based on DTP

4.2.1 Create Logical system for the DBCON entry

Page 13: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 8

4.2.2 Create DB Connect Source SystemTransaction RSA1 Modeling/Source Systems DB Connect.Select the logical system above and maintain the connection parameters.

4.2.3 Create VirtualProvider based on DTPTransaction RSA1 Modeling InfoProviderFrom the context menu of the selected InfoArea choose Create VirtualProvider …Select the appropriate options according to the scenario and proceed with the standard steps andactivate the VirtualProvider.

VirtualProvider based on DTP:

...

4.2.4 Create DataSource for the HANA DB Connect source system1. Transaction RSA1 Modeling/DataSources

Select the HANA DB Connect source system and create a DataSourceSelect the appropriate type:

e.g. for HANA Attribute view choose Master data type.

2. On the Extraction taba. Enter the schema name in the DB User field

ImportantDo not enter DB user here but the schema of the table or view! Note that HANA viewsare under the ‘_SYS_BIC’ schema!

b. Enter the name of the source table or view. You can use the search help

Page 14: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 9

From the list select the table or view.

c. Make sure you allow the Direct Access

3. On the Proposal tabReview the fields and make your selection.

4. On the Fields tabFinalize your settings and activate the DataSource.

Page 15: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 10

5. Process to the Preview tabVerify the DataSource by reading the data.

TipKeep the number of records low – this is not a performance test!

4.2.5 Create Transformation and DTP for the VirtualProvider

For the DTP scenario follow the standard steps: Creating VirtualProviders Based on Data TransferProcesses :...

1. Create the required Transformation2. Create the DTP3. Activate the Direct access

4.3 Scenario: VirtualProvider with Function Module

4.3.1 Create Mapping Tables...

1. Create Mapping tablesCreate the two mapping tables with the fields below – transaction SE11

Page 16: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 11

Mapping table between VirtualProvider and HANA model or table

Mapping table between InfoObjects and fields of the HANA model or table

Settings for both tables:

In the Technical settings enter USER for data class for both tables:

Page 17: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 12

Extras Enhancement Category = Can be enhanced (deep)

2. Create Table Maintenance DialogCreate a table maintenance dialog – transaction SE11:Utilities Table Maintenance Generator.

4.3.2 Create user-defined Function ModuleImplement the user-defined code (SE37) – you can take the code sample and create the functionmodule ( Appendix - Function Module sample ).The sample code provide a general read of HANA-models (the type of the HANA model is notconsidered (Calculation view vs. Analytic view, or raw table).He program executes the SQL statement and fetches the result set from HANA in one step.

Page 18: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 13

It is possible to extend the code to execute the COUNT to receive the number of records for theSQL statement, and then build the data fetch according to the package size.

It is also possible to use the ADBC framework to receive result set from stored procedures in SAPHANA.

4.3.3 Create VirtualProvider with FMTransaction RSA1 Modeling InfoProviderFrom the context menu of the selected InfoArea choose Create VirtualProvider …Select the appropriate options according to the scenario and proceed with the standard steps andactivate the VirtualProvider.

VirtualProvider with FM:

Select Details and create the VirtualProvider with the options below. Enter the user-definedfunction module:

Proceed with the standard steps and activate the VirtualProvider

Page 19: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 14

4.4 Create QueryCreate BW query on top of the VirtualProvider and test the results. You can validate the resultsagainst the source models/tables using e.g. SQL in the HANA Studio.

5. Data loading for HANA Views via OperationalData Providers

With the Operational Data Provisioning it is possible to load data into BW from remote HANAsystem.For details see the online documentations:Transferring Data Using Operational Data ProvisioningNotes about transferring data from SAP HANA using ODP – note the specifics about therestrictions regarding HANA models, naming conventions, length restrictions in technical names.

NoteTransferring data from the SAP HANA database with ODP is not supported for thefollowing:

Hierarchies in attribute viewsVirtualProviders based on the data transfer processReal-time data acquisition

Prerequisite:You can use Operational Data Provisioning (ODP) to connect the SAP HANA database of an ABAPsystem as the source system to the BW system. Communication is performed using RFC. With theODP context for SAP HANA (HANA), analytic views, calculation views and associated attributeviews are provided for replication into BW. This allows you to perform calculations in the SAP HANAdatabase on the views, before they are loaded into BW. These calculations could be currencytranslations and restricted key figures or key figures calculated before aggregation for example, orjoins and unions.

RecommendationFor SAP HANA systems without ABAP stack use DB Connect for loading data into BW.

5.1 Create ODP Source system...

1. Create RFC connection with the ABAP system running on SAP HANA.

2. RSA1 Source Systems: create ODP source system from the ODP folder

Page 20: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 15

Choose RFC for communication channel:

Select HANA Context:

5.2 Create ODP DataSource on SAP HANA View...

1. Create ODP DataSource on the ODP source systemRSA1 DataSources – choose the ODP source system

Page 21: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 16

2. Create the DataSource by selecting the HANA model

3. Accept the proposed fields and activate the DataSource

Page 22: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 17

4. Validate the data source

5. Create InfoPackage and test the data load to PSAYou can build dataflow to load the data into InfoProviders in BW.

A setting in the data transfer process allows you to load the data into the InfoProvider directlywithout the need to load it into the PSA via an InfoPackage first: Loading Data Directly into anInfoProvider from the ODP Source System.

Page 23: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 18

6. AppendixAppendix A – Function ModuleFunction Module: Z_HANA_VPROV_READ

FUNCTION Z_HANA_VPROV_READ.

*"----------------------------------------------------------------------

*"*"Local Interface:

*" IMPORTING

*" REFERENCE(I_INFOPROV) TYPE RSINFOPROV

*" REFERENCE(I_TH_SFC) TYPE RSDRI_TH_SFC

*" REFERENCE(I_TH_SFK) TYPE RSDRI_TH_SFK

*" REFERENCE(I_T_RANGE) TYPE RSDRI_T_RANGE OPTIONAL

*" REFERENCE(I_TX_RANGETAB) TYPE RSDRI_TX_RANGETAB OPTIONAL

*" REFERENCE(I_TSX_HIER) TYPE RSDRI_TSX_HIER OPTIONAL

*" REFERENCE(I_FIRST_CALL) TYPE RS_BOOL OPTIONAL

*" REFERENCE(I_PACKAGESIZE) TYPE I DEFAULT 20000000

*" REFERENCE(I_KEYDATE) TYPE RRSRDATE DEFAULT SY-DATUM

*" REFERENCE(I_MAXROWS) TYPE I DEFAULT 2147483647

*" REFERENCE(I_USE_AGGREGATION) TYPE RS_BOOL DEFAULT RS_C_TRUE

*" REFERENCE(I_SHOW_STATEMENT) TYPE RS_BOOL DEFAULT RS_C_FALSE

*" EXPORTING

*" REFERENCE(E_T_DATA) TYPE STANDARD TABLE

*" REFERENCE(E_END_OF_DATA) TYPE RS_BOOL

*" REFERENCE(E_T_MSG) TYPE RS_T_MSG

*" EXCEPTIONS

*" REMOTE_READ_FAILED

*" X_MESSAGE

*"----------------------------------------------------------------------

* This is a template for a local virtual infoprovider without SID support -

RSDRI_VPROV_READ_TEMPLATE

* See the template function module documentation

DEFINE check_subrc.

if sy-subrc <> 0 or l_subrc <> 0.

message e301(dbman) with &1 &2 &3 &4 into l_message.

move-corresponding syst to l_s_msg.

append l_s_msg to e_t_msg.

raise remote_read_failed.

endif.

END-OF-DEFINITION. "check_subrc

* Set the DB Connect name for the HANA system

" alternatively could be an input in the mapping table in case there are multiple HANA DB-

connections

CONSTANTS:

HDB_CON TYPE dbcon_name VALUE 'HANAWR1'.

TYPES:

Page 24: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 19

BEGIN OF y_s_mapping,

iobjnm TYPE rsiobjnm,

hananm TYPE rshdbattrnm,

chaconst TYPE rschaconst,

END OF y_s_mapping,

y_th_mapping TYPE HASHED TABLE OF y_s_mapping WITH UNIQUE KEY iobjnm.

TYPES:

BEGIN OF t_mapping,

iobjnm TYPE rsiobjnm,

alias TYPE rsalias,

hananm TYPE rshdbattrnm,

END OF t_mapping.

STATICS:

s_th_mapping TYPE y_th_mapping.

*-- ADBC Classes

DATA:

l_hdb_con TYPE REF TO cl_sql_connection,

l_hdb_sql TYPE REF TO cl_sql_statement,

l_hdb_rs TYPE REF TO cl_sql_result_set,

l_hdb_md TYPE REF TO cl_sql_metadata,

l_hdb_err TYPE REF TO cx_sql_exception.

DATA:

l_s_sfc TYPE rsdri_s_sfc,

l_s_sfk TYPE rsdri_s_sfk,

l_s_range TYPE rsdri_s_range,

l_t_range TYPE rsdri_t_range,

l_t_range_hdb TYPE rsdri_t_range,

l_message TYPE string,

l_s_msg TYPE rs_s_msg,

l_s_mapping TYPE y_s_mapping,

l_t_model TYPE STANDARD TABLE OF ZVPHANA_MODEL,

l_s_model LIKE LINE OF l_t_model,

l_sql TYPE string,

l_model TYPE string,

l_schema TYPE string,

l_from TYPE string,

l_fieldlist TYPE string,

l_aggregation TYPE string,

l_group_by TYPE string,

l_quoted_fieldnm TYPE string,

l_where TYPE string,

l_subrc TYPE sy-subrc,

lt_mapping TYPE STANDARD TABLE OF t_mapping,

ls_mapping TYPE t_mapping,

l_row_cnt TYPE i,

l_size TYPE i.

Page 25: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 20

*-- WHERE clause generation

DATA:

acc_gen_cp TYPE rsmds_boolean,

l_r_universe TYPE REF TO cl_rsmds_universe,

l_r_renderer TYPE REF TO if_rsmds_condition_renderer,

l_r_set TYPE REF TO cl_rsmds_set,

incl_null TYPE rsmds_boolean,

rx_message TYPE REF TO cx_rsmds_message,

wa_where TYPE lvc_s_fcat,

it_where TYPE lvc_t_fcat,

dyn_t_where TYPE REF TO data.

*-- HANA Result set receiving area

DATA:

dyn_l_result TYPE REF TO data,

hana_fields TYPE adbc_rs_metadata_descr_tab,

hana_field TYPE adbc_rs_metadata_descr,

hana_rs_md TYPE REF TO data,

ls_hana TYPE REF TO CL_ABAP_DATADESCR,

lt_hana TYPE REF TO CL_ABAP_TABLEDESCR,

field1 TYPE string,

field2 TYPE string,

it_hana TYPE REF TO data,

e_s_data TYPE REF TO data.

FIELD-SYMBOLS:

<fs_where> TYPE STANDARD TABLE,

<fs_t_result> TYPE STANDARD TABLE,

<fs_l_result>,

<l_s_data>,

<e_s_data>,

<l_t_data> TYPE STANDARD TABLE,

<l_s_fields>,

<l_s_mapping>,

<l_s_sfc> TYPE rsdri_s_sfc,

<l_s_sfk> TYPE rsdri_s_sfk,

<l_s_range> TYPE rsdri_s_range,

<l_t_range> TYPE rsdri_t_range,

<hana_field> TYPE adbc_rs_metadata_descr.

**********************************************************************************************

**

IF i_first_call = rs_c_true.

*--------------------------------------------------------------------------------------------*

*-- Read Mapping tables --*

*--------------------------------------------------------------------------------------------*

*-- HANA Model Name from table ZVPHANA_MODELtable ZVPHANA_MODEL

Page 26: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 21

SELECT * FROM ZVPHANA_MODEL INTO CORRESPONDING FIELDS OF l_s_model WHERE infoprov EQ i_inf

oprov.

check_subrc 'No HANA Model for' i_infoprov 'in the mapping table' 'ZVPHANA_MODEL'.

l_schema = l_s_model-hdbschema.

l_model = l_s_model-hdbmodnm.

CONCATENATE 'FROM "' l_schema '"."' l_model '"' INTO l_from.

ENDSELECT.

*-- InfoObject <-> Field of HANA Model from table ZVPHANA_FIELDS

** Read "global" mapping first (not InfoProvider specific)

SELECT * FROM ZVPHANA_FIELDS INTO CORRESPONDING FIELDS OF TABLE s_th_mapping

WHERE infoprov = space.

** Read InfoProvider specific mappings and overwrite "global"

SELECT * FROM ZVPHANA_FIELDS INTO CORRESPONDING FIELDS OF l_s_mapping

WHERE infoprov = i_infoprov.

DELETE s_th_mapping WHERE ( iobjnm = l_s_mapping-iobjnm ). "AND hananm = l_s_mapping-

hananm ).

INSERT l_s_mapping INTO TABLE s_th_mapping.

ENDSELECT.

*--------------------------------------------------------------------------------------------*

*-- Build SELECT List (Characteristics) & GROUP BY (All CHAs included in GROUP BY) --*

*--------------------------------------------------------------------------------------------*

LOOP AT i_th_sfc ASSIGNING <l_s_sfc>.

READ TABLE s_th_mapping INTO l_s_mapping WITH TABLE KEY iobjnm = <l_s_sfc>-chanm.

CHECK sy-subrc EQ 0.

CONCATENATE '"' l_s_mapping-hananm '"' INTO l_quoted_fieldnm.

*-- begin -- Maintain Field Mappings

CLEAR: ls_mapping.

MOVE: <l_s_sfc>-CHANM TO ls_mapping-iobjnm,

<l_s_sfc>-CHAALIAS TO ls_mapping-alias,

l_s_mapping-HANANM TO ls_mapping-hananm.

APPEND ls_mapping TO lt_mapping.

*-- end -- Maintain Field Mappings

IF l_fieldlist IS INITIAL.

l_fieldlist = l_quoted_fieldnm.

CONCATENATE 'GROUP BY' l_quoted_fieldnm INTO l_group_by SEPARATED BY space. " Group B

y

ELSE.

CONCATENATE l_fieldlist ',' l_quoted_fieldnm INTO l_fieldlist. " Field List

CONCATENATE l_group_by ',' l_quoted_fieldnm INTO l_group_by. " Group By

ENDIF.

check_subrc 'No HANA Field for' <l_s_sfc>-chanm 'in the mapping table' 'ZVPHANA_FIELDS'.

ENDLOOP.

Page 27: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 22

*--------------------------------------------------------------------------------------------*

*-- Build SELECT List (Key Figures + Aggregation Function)

*--------------------------------------------------------------------------------------------*

LOOP AT i_th_sfk ASSIGNING <l_s_sfk>.

READ TABLE s_th_mapping INTO l_s_mapping WITH TABLE KEY iobjnm = <l_s_sfk>-kyfnm.

IF sy-subrc EQ 0.

IF l_s_mapping-hananm IS INITIAL.

l_subrc = 4.

ENDIF.

*-- begin -- Maintain Field Mappings

CLEAR ls_mapping.

MOVE: <l_s_sfk>-KYFNM TO ls_mapping-iobjnm,

<l_s_sfk>-KYFALIAS TO ls_mapping-alias,

l_s_mapping-HANANM TO ls_mapping-hananm.

APPEND ls_mapping TO lt_mapping.

*-- end -- Maintain Field Mappings

CONCATENATE '"' l_s_mapping-hananm '"' INTO l_quoted_fieldnm.

IF l_aggregation IS INITIAL.

CONCATENATE ',SUM(' l_quoted_fieldnm ')' INTO l_aggregation. " Field List + Agg

regate

ELSE.

CONCATENATE l_aggregation ',' 'SUM(' l_quoted_fieldnm ')' INTO l_aggregation. " Fie

ld List + Aggregate

ENDIF.

ENDIF.

check_subrc 'No HANA Field for' <l_s_sfk>-kyfnm 'in the mapping table' 'ZVPHANA_FIELDS'.

ENDLOOP.

*--------------------------------------------------------------------------------------------*

*-- Build WHERE Clause from I_T_RANGE --*

*--------------------------------------------------------------------------------------------*

IF i_t_range IS NOT INITIAL. "If no selection no need for WHERE Clause

* clean-up RANGE

l_t_range = i_t_range.

SORT l_t_range BY chanm sign DESCENDING low high.

DELETE ADJACENT DUPLICATES FROM l_t_range.

* Replace the IObj name with HANA name

LOOP AT l_t_range INTO l_s_range. "ASSIGNING <l_s_range>.

AT NEW CHANM.

READ TABLE s_th_mapping INTO l_s_mapping WITH KEY iobjnm = l_s_range-chanm.

IF sy-subrc EQ 0.

"build field catalog for dynamic table

wa_where-fieldname = l_s_mapping-hananm.

wa_where-datatype = 'CHAR'.

wa_where-OUTPUTLEN = '60'.

Page 28: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 23

APPEND wa_where TO it_where.

ENDIF.

ENDAT.

l_s_range-chanm = l_s_mapping-hananm.

APPEND l_s_range TO l_t_range_hdb.

ENDLOOP.

**-- Create dynamic internal table and assign to Field-Symbol (WHERE)

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_where

IMPORTING

ep_table = dyn_t_where.

ASSIGN dyn_t_where->* TO <fs_where>.

**-- Create WHERE Clause dynamically, per L_T_RANGE_HDB

l_r_universe = cl_rsmds_abap_universe=>create_by_data( <fs_where> ).

TRY .

l_r_set = l_r_universe->create_set_from_ranges( i_t_ranges = l_t_range_hdb[]

i_fieldname_dimension = 'CHANM' ).

ENDTRY.

l_r_renderer = cl_rsmds_native_sql_renderer=>get_condition_renderer( ).

l_where = l_r_set->to_string( i_r_renderer = l_r_renderer

i_use_alias = rsmds_c_boolean-true ).

ENDIF.

**-- Complete WHERE Clause

IF l_where IS NOT INITIAL.

CONCATENATE 'WHERE' l_where INTO l_where SEPARATED BY space.

ENDIF.

*--------------------------------------------------------------------------------------------*

*-- Build SQL Statement

*--------------------------------------------------------------------------------------------*

CONCATENATE 'SELECT' ' ' l_fieldlist l_aggregation ' ' l_from ' ' l_where ' ' l_group_by I

NTO l_sql.

*--------------------------------------------------------------------------------------------*

*-- Create/Execute QUERY

*--------------------------------------------------------------------------------------------*

TRY .

*-- Open connection to HANA DB, SQL statement engine, HANA metadata

l_hdb_con = cl_sql_connection=>get_connection( con_name = 'HANAWR1' ).

l_hdb_sql = l_hdb_con->create_statement( ).

l_hdb_md = l_hdb_con->get_metadata( ).

Page 29: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 24

CATCH cx_sql_exception INTO l_hdb_err.

IF l_hdb_con IS NOT INITIAL.

TRY .

l_hdb_con->close( ).

CATCH cx_sql_exception INTO l_hdb_err.

PERFORM handle_sql_exception USING l_hdb_err E_T_MSG E_END_OF_DATA.

ENDTRY.

ENDIF.

ENDTRY.

TRY.

l_hdb_rs = l_hdb_sql->execute_query( statement = l_sql ).

CATCH cx_sql_exception INTO l_hdb_err.

PERFORM handle_sql_exception USING l_hdb_err E_T_MSG E_END_OF_DATA.

ENDTRY.

ENDIF. "i_first_call = rs_c_true

*--------------------------------------------------------------------------------------------*

*-- Get the result data set back into ABAP internal table

*--------------------------------------------------------------------------------------------*

CHECK l_hdb_rs IS BOUND.

**-- Build receiving area from HANA metadata

hana_fields = l_hdb_rs->get_metadata( ). "returns aggregation function!

LOOP AT hana_fields ASSIGNING <hana_field>.

field1 = <hana_field>-column_name.

IF field1+0(3) = 'SUM'.

SHIFT field1 LEFT DELETING LEADING 'SUM('.

SHIFT field1 RIGHT DELETING TRAILING ')'.

SHIFT field1 LEFT DELETING LEADING space.

<hana_field>-column_name = field1.

MODIFY hana_fields INDEX sy-tabix FROM <hana_field> TRANSPORTING column_name.

ENDIF.

ENDLOOP.

hana_rs_md = l_hdb_rs->get_struct_ref( hana_fields ).

ls_hana ?= cl_abap_structdescr=>describe_by_data_ref( hana_rs_md ).

lt_hana = cl_abap_tabledescr=>create( ls_hana ).

CREATE DATA it_hana TYPE HANDLE lt_hana.

l_hdb_rs->set_param_table( it_hana ).

ASSIGN it_hana->* TO <fs_t_result>.

* Create dynamic work area and assign to Field Symbol

CREATE DATA dyn_l_result LIKE LINE OF <fs_t_result>.

Page 30: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 25

ASSIGN dyn_l_result->* TO <fs_l_result>.

** Read data in one step

l_row_cnt = l_hdb_rs->next_package( i_maxrows ).

E_END_OF_DATA = rs_c_true.

l_hdb_rs->close( ).

DATA: struct_descr TYPE REF TO cl_abap_structdescr.

DATA str_hana TYPE REF TO cl_abap_structdescr.

FIELD-SYMBOLS: <components> LIKE LINE OF cl_abap_structdescr=>components,

<iobj_alias> TYPE any,

<hana_name> TYPE any,

<comp1> TYPE any,

<comp2> TYPE any.

* Create dynamic work area and assign to Field Symbol

CREATE DATA e_s_data LIKE LINE OF e_t_data.

ASSIGN e_s_data->* TO <e_s_data>.

*--------------------------------------------------------------------------------------------*

*-- Map HANA result set to OLAP and return E_T_DATA

*--------------------------------------------------------------------------------------------*

TRY.

str_hana ?= cl_abap_typedescr=>describe_by_data( <fs_l_result> ).

CATCH cx_sy_move_cast_error.

RETURN.

ENDTRY.

LOOP AT <fs_t_result> ASSIGNING <fs_l_result>.

LOOP AT str_hana->components ASSIGNING <components>.

READ TABLE lt_mapping INTO ls_mapping WITH KEY hananm = <components>-name.

ASSIGN COMPONENT ls_mapping-alias OF STRUCTURE <e_s_data> to <iobj_alias>.

IF sy-subrc EQ 0.

ASSIGN COMPONENT sy-tabix OF STRUCTURE <fs_l_result> to <hana_name>.

<iobj_alias> = <hana_name>.

ENDIF.

ENDLOOP.

APPEND <e_s_data> to e_t_data.

ENDLOOP.

ENDFUNCTION.

*---------------------------------------------------------------------*

* FORM handle_sql_exception

*---------------------------------------------------------------------*

* Writes the SQL error code and error message to the output list.

*---------------------------------------------------------------------*

* --> PX_SQLERR the caught SQL exception

*---------------------------------------------------------------------*

Page 31: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

How to consume Models in SAP NetWeaver BW from remote HANA instances

June 2013 26

FORM handle_sql_exception USING px_sqlerr TYPE REF TO cx_sql_exception

E_MSG TYPE RS_T_MSG

E_END TYPE RS_BOOL.

DATA: lv_olen TYPE i,

ls_msg TYPE RS_S_MSG,

lv_msgtext TYPE CHAR255.

MOVE: px_sqlerr->sql_message TO lv_msgtext.

CONCATENATE: 'SQL Error: ' lv_msgtext INTO lv_msgtext RESPECTING BLANKS.

*-- Maximum Number of Message Variables - 4

DO 4 TIMES.

CASE sy-index.

WHEN 1.

MOVE: lv_msgtext TO ls_msg-msgv1. " Length of Message Variable = 53 characters

WHEN 2.

MOVE: lv_msgtext+53 TO ls_msg-msgv2. " Length of Message Variable = 53 characters

WHEN 3.

MOVE: lv_msgtext+106 TO ls_msg-msgv3. " Length of Message Variable = 53 characters

WHEN 4.

MOVE: lv_msgtext+159 TO ls_msg-msgv4. " Length of Message Variable = 53 characters

ENDCASE.

ENDDO.

*--

Currently using Message Class SY, Message Number 499 as placeholder. Will require 4 empty me

ssage variables, as we will populate dynamically, per error message

MOVE: 'E' TO ls_msg-msgty, " Error Message

'499' TO ls_msg-msgno, " <-- Create Custom Message Number

'SY' TO ls_msg-MSGID. " <-- Create Custom Message Class

APPEND ls_msg TO E_MSG.

E_END = 'X'.

ENDFORM. "HANDLE_SQL_EXCEPTION

Page 32: How to Consume SAP HANA Models in SAP NetWeaver BW …a248.g.akamai.net/n/248/.../420835/sapcom/docs/2015/07/...eda71af51… · Sybase and Adaptive Server, ... ). ... (SAP BW powered

www.sap.com/contactsap

www.sdn.sap.com/irj/sdn/howtoguides