How To...Consume HANA Models with Input Parameters in BW Virtual Providers

SAP How-to Guide
Database & Technology
SAP HANA™ Appliance
How To...Consume HANA Models with Input
Parameters in BW Virtual Providers
Applicable Releases:
SAP HANA 1.0 SPS 04
SAP BW powered by HANA 7.3 SP9
Version 1.0
January 2013
© Copyright 2013 SAP AG. All rights reserved.
All other product and service names mentioned are the trademarks of
No part of this publication may be reproduced or transmitted in any form
their respective companies. Data contained in this document serves
or for any purpose without the express permission of SAP AG. The
informational purposes only. National product specifications may vary.
information contained herein may be changed without prior notice.
The information in this document is proprietary to SAP. No part of this
Some software products marketed by SAP AG and its distributors
document may be reproduced, copied, or transmitted in any form or for
contain proprietary software components of other software vendors.
any purpose without the express prior written permission of SAP AG.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered
This document is a preliminary version and not subject to your license
trademarks of Microsoft Corporation.
agreement or any other agreement with SAP. This document contains
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,
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.
OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS,
SAP assumes no responsibility for errors or omissions in this document.
HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex,
SAP does not warrant the accuracy or completeness of the information,
MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and
text, graphics, links, or other items contained within this material. This
Informix are trademarks or registered trademarks of IBM Corporation.
document is provided without a warranty of any kind, either express or
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.
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 implementtation. 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
Java is a registered trademark of Sun Microsystems, Inc.
business problem using SAP NetWeaver. Should you wish to receive
JavaScript is a registered trademark of Sun Microsystems, Inc., used
additional information, clarification or support, please refer to SAP
under license for technology invented and implemented by Netscape.
Consulting.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP
Any software coding and/or code lines / strings (“Code”) included in this
BusinessObjects Explorer, StreamWork, and other SAP products and
documentation are only examples and are not intended to be used in a
services mentioned herein as well as their respective logos are
productive system environment. The Code is only intended better explain
trademarks or registered trademarks of SAP AG in Germany and other
and visualize the syntax and phrasing rules of certain coding. SAP does
countries.
not warrant the correctness and completeness of the Code given herein,
Business Objects and the Business Objects logo, BusinessObjects,
and SAP shall not be liable for errors or damages caused by the usage of
Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other
the Code, except if such damages were caused by SAP intentionally or
Business Objects products and services mentioned herein as well as their
grossly negligent.
respective logos are trademarks or registered trademarks of Business
Disclaimer
Objects Software Ltd. Business Objects is an SAP company.
Some components of this product are based on Java™. Any code change
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere,
in these components may cause unpredictable and severe malfunctions
and other Sybase products and services mentioned herein as well as their
and is therefore expressively prohibited, as is any decompilation of these
respective logos are trademarks or registered trademarks of Sybase, Inc.
components.
Sybase is an SAP company.
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.
Document History
Document Version
Description
1.00
First version of this guide
Typographic Conventions
Icons
Type Style
Description
Icon
Example Text
Words or characters quoted
from the screen. These
include field names, screen
titles, pushbuttons labels,
menu names, menu paths,
and menu options.
Cross-references to other
documentation
Example text
Emphasized words or
phrases in body text, graphic
titles, and table titles
Example text
File and directory names and
their paths, messages,
names of variables and
parameters, source text, and
names of installation,
upgrade and database tools.
Example text
User entry texts. These are
words or characters that you
enter in the system exactly
as they appear in the
documentation.
<Example
text>
Variable user entry. Angle
brackets indicate that you
replace these words and
characters with appropriate
entries to make entries in the
system.
EXAMPLE TEXT
Keys on the keyboard, for
example, F2 or ENTER.
Description
Caution
Note or Important
Example
Recommendation or Tip
Table of Contents
1.
Business Scenario .................................................................................................................1
2.
Background Information .......................................................................................................1
3.
Prerequisites ......................................................................................................................... 2
4.
Step-by-Step Procedure ...................................................................................................... 3
5.
4.1
Create Analytical View in SAP HANA ............................................................................. 3
4.2
Create VirtualProvider in SAP BW .................................................................................. 5
4.3
Create BEx Query based on the Virtual Provider .......................................................... 6
4.4
Verify the results .............................................................................................................. 7
4.5
Limitations ........................................................................................................................ 9
Appendix ................................................................................. Error! Bookmark not defined.
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
1.
Business Scenario
In SAP BW 7.30 powered by SAP HANA, it is possible to create Virtual Providers which are based on
SAP HANA (HANA) Models.
This provides a powerful means of integrating native HANA models into the SAP BW environment;
thereby leveraging some of SAP BW’s powerful capabilities like Hierarchies, Analysis
Authorizations, centrally governed Master Data/Texts.
However, it is common practice to design HANA models to be configurable via Input Parameters
and consumption of such models in BW Virtual Providers can be tricky.
It is important here to mention the difference between Input Parameters and Variables in HANA.
Variables are used purely to restrict the data dynamically based on user input whereas input
parameters provide a means of creating models which can be configured dynamically based on
user input. Although input parameters can be employed in HANA models for a variety of use-cases,
they are most often used in formulas for calculated measures.
Hence for the purpose of illustration, this document addresses a very basic Sales Deviation
Analysis scenario where a company reports on year-on-year deviation in sales with the users having
the flexibility to dynamically choose the years being compared in the analysis.
This how-to guide describes how such a scenario can be modeled as a native HANA model with
input parameters for defining the years of comparison. The HANA model is subsequently
consumed in a BW Virtual Provider. The users report on the data based on a BEx Query built on top
of the Virtual Provider.
2.
Background Information
The procedure of creating VirtualProviders based on a HANA Models in SAP BW is described here
in detail –
http://help.sap.com/saphelp_nw73/helpdata/en/e4/e39762e1854b24a7230849c9ff589e/frame
set.htm.
The VirtualProvider in BW is an InfoProvider based on InfoObjects. The InfoObjects –
Characteristics and KeyFigures – are mapped to the corresponding Attributes and Measures of the
HANA model respectively.
However, to allow the users the option to supply values to the HANA model input parameters via a
BEx Query, there are two basic steps needed –


Map the input parameters to InfoObjects in the BW Virtual Provider. If there are no
InfoObjects existing for re-use, they may need to be created in the BW system.
In the BEx Query built on top of the VirtualProvider, create BEx Variables to allow users to
supply values to the HANA Model input parameters.
The following sections of the document describe how this can be done for the Sales Deviation
Analysis scenario in a step-by-step manner.
January 2013
1
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
3.
Prerequisites
This how-to guide is intended for readers building scenarios which combine native HANA Models
with the SAP BW environment, popularly called – HANA-BW Mixed Scenarios. Readers with prior
experience in modeling in the HANA Studio and SAP BW will benefit the most from the document.

Release Information
o
SAP BW powered by HANA
The feature described in this how-to guide is available starting from SAP BW 7.30
powered by HANA SP9 or SAP NetWeaver BW 7.31 (SAP NW BW7.0 EnhP 3)..
The feature can also be made available by applying the SAP Note 1742176.
However, the pre-requisite support package for applying the note is SP7.
This feature has to be explicitly switched-on in the SAP BW system using the
RSADMIN parameter – ‘RSDRV_HANA_INPUTPARAM_ALLOWED’ (even in
SP9). The parameter can be set by using the standard SAP report –
‘SAP_RSADMIN_MAINTAIN’. A value ’X’, against this parameter switches the
feature ON in the system.
Relevant SAP Notes

o
Also refer the SAP Notes – 1742176 and 1814038
HANA
The parameterization of HANA models with Input Parameter is available starting
from HANA 1.0 SP4
Relevant SAP Notes

January 2013
Also refer the SAP Note - 1691126
2
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
4.
Step-by-Step Procedure
The Year-on-Year Sales Deviation Analysis scenario is addressed by creating an Analytical View in
HANA with Input Parameters – I_CALYEAR_1 and I_CALYEAR_2 - for the two years being
compared.
The Sales Amount for each year is implemented as calculated measure which uses the value of the
corresponding Input Parameter to compute the Sales Amount. The year-on-year deviation in Sales
Amounts is calculated as the difference between the individual sales amounts of the two years.
The HANA model is consumed in a BW VirtualProvider by mapping the attributes and measures to
corresponding BW InfoObjects. Further, two new InfoObjects – ICALYR_1 and ICALYR_2 – are
created for the mapping the Input Parameters defined above.
A BEx Query is defined on the VirtualProvider with Variables on the two InfoObjects – ICALYR_1 and
I_CALYR_2 to allow users the option of choosing the years of comparison at query runtime.
4.1
Create Analytical View in HANA
...
1. Create Analytical View in HANA Studio.
Below is a screen-shot of an Analytical View in the HANA Studio. The Analytical View is based
on monthly sales data of a company. Notice that the model contains the attribute CALYEAR
and the measure SALES.
January 2013
3
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
2. To enable users to select the years at query runtime, two Input Parameters – I_CALYEAR_1
and I_CALYEAR_2 are created.
3. Two calculated measures – SALES_T1 and SALES_T2 - are created to compute the sales
amount of Year 1 and Year 2 respectively. Notice how the Input Parameters created above
are used in the formula as place-holders.
January 2013
4
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
4. Create another calculated measure – DEV_SALES (Deviation in SALES) – to compute the
deviation in the sales measures – SALES_T2 and SALES_T1
5. Activate the Analytical View.
4.2
Create VirtualProvider in SAP BW
...
1. Create a VirtualProvider in SAP BW based on the AnalyticalView created above.
2.
(Optional) Add a new dimension to the VirtualProvider – “InputParameters”.
3.
Add 2 InfoObjects – I_CALYR_1 and I_CALYR_2 to the VirtualProvider definition to allow
mapping of Input Parameters.
4. The Attributes and Measures defined in the HANA model are mapped to corresponding BW
Characteristics and Key-figures respectively. Map the two InfoObjects, I_CALYR_1 and
I_CALYR_2, to the two input parameters, I_CALYEAR_1 and I_CALYEAR_2, respectively.
January 2013
5
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
5. Activate the VirtualProvider.
4.3
Create BEx Query based on the Virtual Provider
...
1. Create a BEx Query based on the Virtual Provider defined above.
2. Create two Characteristic Value Variables, V_CALYEAR_1 and V_CALYEAR_2, based on the
two InfoObjects, I_CALYR_1 and I_CALYR2, respectively.
3. Save the Query.
January 2013
6
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
4.4
Verify the results
1. Execute the Query created above in transaction RSRT in the SAP BW system in debug mode.
2. Fill in the required values in the Variable Pop-up screen; in this case 2010 and 2011 are
entered as values.
3. Notice that the values entered for the two variables are passed as placeholders down to the
HANA model, implying that the Input Parameters are filled with the values supplied.
January 2013
7
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
4. The HANA model is executed with the input values and result is a with year-on-year deviation
in sales for the years - 2010 and 2011.
January 2013
8
How To...Consume HANA Models with Input Parameters in BW Virtual Providers
4.5


Limitations
Input Parameters in HANA currently support only single values. Therefore, it is only
possible to use single-value BEx Variables for passing values to the HANA model Input
Parameters. There is no built-in check for this in the BEx Query Designer. Hence, a
mismatch might result in an error at query runtime.
InfoObjects in the VirtualProvider mapped to the HANA Input Parameters should never be
allowed as drill-down characteristics. This results in an error at query runtime.
January 2013
9
www.sap.com/contactsap
www.sdn.sap.com/irj/sdn/howtoguides