0% found this document useful (0 votes)
213 views62 pages

SAP Analytics Cloud - Setup Live Data Connection Using SAP HANA Smart Data Access

Uploaded by

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

SAP Analytics Cloud - Setup Live Data Connection Using SAP HANA Smart Data Access

Uploaded by

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

SAP How-to Guide

SAP Analytics Cloud

SAP Analytics Cloud: Expand Live Data


Connectivity to Heterogenous Data Sources via
SAP HANA
Provided by SAP Platform & Technology, Global Adoption and Consumption Centre of Excellence

Applicable Releases:
SAP Analytics Cloud
SAP HANA 2.0 SP00 and above

Version 1.10
March 2021
Document History
Document Version Description

1.00 First official release of this guide


Icons
Typographic Conventions
Icon Description
Type Style Description
Caution
Example Text Words or characters quoted
from the screen. These Note or Important
include field names, screen Example
titles, pushbuttons labels,
menu names, menu paths, Recommendation or Tip
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 Variable user entry. Angle
text> 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.
Table of Contents
1. Prerequisites ........................................................................................................................ 1

2. Introduction .......................................................................................................................... 2
2.1 Goal .............................................................................................................................. 2
2.2 Background................................................................................................................... 2
2.2.1 Live Data Connectivity in SAP Analytics Cloud ............................................... 2
2.2.2 The Challenge and the Solution ...................................................................... 3
2.2.3 Connecting SAP HANA to Remote Data Sources ........................................... 4
2.2.3.1 Virtualizing Data Using SDA ........................................ 4
2.2.3.2 Virtualizing Data Using SDI .......................................... 4
2.2.4 Advantages of Using SAP HANA Smart Data Access .................................... 5
2.2.4.1 Live Analytics ............................................................... 5
2.2.4.2 Row-level Security ....................................................... 5
2.2.4.3 Additional Value ........................................................... 6

3. Setup Live Data Connection to SQL Server Using HANA Smart Data Access ............. 7
3.1 Setup SQL Server ODBC Driver .................................................................................. 8
3.2 Add SQL Server as a Remote Source ....................................................................... 12
3.3 Create a Calculation View with the Virtual Tables from SQL Server ......................... 15
3.4 Create a story in SAP Analytics Cloud using Live Data Connection to HANA ........... 18
3.5 Best Practices of SAP HANA SDA Modeling ............................................................. 24

4. Setup Live Data Connection to S/4HANA Using HANA Smart Data Integration ......... 26
4.1 Install and Configure SAP Data Provisioning Agent................................................... 27
4.2 Add S/4HANA as a Remote Source ........................................................................... 31
4.3 Create Custom BAPIs in SAP S/4HANA .................................................................... 33
4.4 Create a Calculation View with the Virtual Procedure from S/4HANA ....................... 46
4.5 Create a story in SAP Analytics Cloud ....................................................................... 50

5. Current Limitations............................................................................................................ 56
5.1 Building Calculation Views in SAP HANA .................................................................. 56
5.2 Spatial Data Not Supported .......................................... Error! Bookmark not defined.
5.3 Creating Custom BAPIs in SAP NetWeaver AS ABAP .............................................. 56
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

1. Prerequisites
This guide is written based on the following software versions. The steps for other software versions are mostly the
same or similar, and the differences are pointed out wherever necessary.
• SAP HANA 2.0 SPS03 Version 2.00.034
• Microsoft SQL Server 2016
• S/4HANA on premise 1809
• SAP Data Provisioning Agent 2.4.2 (SP04)

March 2021 1
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

2. Introduction
2.1 Goal
In this document, we propose a solution to expand SAP Analytics Cloud (SAC) live analytics across heterogeneous
sources with SAP HANA Smart Data Access and SAP HANA Smart Data Integration.

2.2 Background
2.2.1 Live Data Connectivity in SAP Analytics Cloud
SAP Analytics Cloud provides live data connections to on-premise and cloud systems. Data is “live”, meaning that when
a user opens a story in SAP Analytics Cloud, up-to-data data in the source system are retrieved immediately.

In SAP Analytics Cloud, you can create models from data sources in on-premise or cloud systems, build stories based
on those models, and perform online analysis without data replication. The Live data connectivity allows SAP Analytics
Cloud to be used in scenarios where data cannot be moved into the cloud for security or privacy reasons, or your data
already exists on a different cloud system.

Using a live connection, SAP Analytics Cloud provides the business logic and builds the queries required to see your
data in your browser. Your browser in turn sends those queries through a direct live connection to the on-premise data

March 2021 2
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

source. The results of those queries are returned to your browser, where visualizations are rendered. If your query
was a list of profits per customer, for example, none of that information would return to or be stored in SAP Analytics
Cloud. SAP Analytics Cloud stores queries for building the stories, measure names, columns names, filter values, and
so on. Basically, the metadata lets SAP Analytics Cloud rebuild the query. But none of the payload data, not even the
query results or part of the results, such as totals, are saved to SAP Analytics Cloud. Metadata is transferred to your
browser and encrypted in memory.

Currently, SAP Analytics Cloud can connect to six types of live data sources: SAP HANA, SAP BW, SAP S/4HANA,
SAP Universe, SAP BPC Embedded, and SAP Data Warehouse Cloud.

2.2.2 The Challenge and the Solution


The live data connection is a preferred connection type for SAC to connect to remote sources, but it can only connect
to six different data sources, specifically, six SAP systems. SAP Analytics Cloud doesn’t provide live data connections
to many other SAP systems, such as SAP SuccessFactors, SAP Concur, SAP Ariba, etc. Neither does SAC provide
live data connections to non-SAP systems, such as Microsoft SQL Server, Oracle, MySQL, etc. These data sources are
widely used by customers today. In addition, this is not only about non-SAP systems, but also about those SAP systems
such as ECC 6 that cannot be connected live today. Although SAC provides acquired data connection to some of the
above SAP and non-SAP data sources, it has limitations on data volume of each data load, maintenance of delta load,
replication and synchronization of authorization models. It would make SAC a broader adopted analytic application if
SAC can provide live analytics to more SAP and non-SAP data sources.

To expand the SAC live analytics across heterogeneous sources, we leverage SAP HANA 2.0 to connect to on-premise
and cloud systems. SAC provides live data connection to SAP HANA, and SAP HANA accesses remote sources using
SAP HANA Smart Data Access and SAP HANA Smart Data Integration.

The following figure illustrates the proposed solution that utilizes SAP HANA as a data gateway to remote sources, and
expands SAC live connectivity to Microsoft SQL Server, Oracle, IBM DB2, Google BigQuery, and several other
databases with SAP HANA Smart Data Access; SAP ERP, MySQL, SAP SuccessFactors, and other data sources with
SAP HANA Smart Data Integration.

March 2021 3
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

2.2.3 Connecting SAP HANA to Remote Data Sources


SAP HANA allows you to access remote data live as if the data were stored in local tables, without copying the data into
SAP HANA. This can be achieved by creating virtual tables using either SAP HANA Smart Data Access (SDA) or SAP
HANA Smart Data Integration (SDI).

2.2.3.1 Virtualizing Data Using SDA

In SAP HANA, you create virtual tables, which point to remote tables in different data sources, and then write SQL
queries in SAP HANA that use these virtual tables. The SAP HANA query processor optimizes these queries by
executing the relevant part of the query in the target database, returning the results of the query to SAP HANA, and
then completing the operation. Physical data movement is not supported by SAP HANA Smart Data Access. Smart Data
Access provides the ability to access and integrate data from multiple systems in real time regardless of where the data
is located or what systems are generating the data. Thus, it can be used for SAC live analytics across heterogeneous
sources.

The following figure shows the SDA supported databases as remote sources for SAP HANA 2.0. For more information,
please see SAP HANA Smart Data Access Supported Remote Sources.

2.2.3.2 Virtualizing Data Using SDI

SAP HANA Smart Data Integration uses SDA as a foundation and extends the capabilities of SDA. SAP HANA SDI also
supports virtually accessing a variety of remote sources in real time using pre-built and custom adapters. You deploy
this method by installing a Data Provisioning Agent that hosts Data Provisioning adapters for connectivity to remote
sources. SDI supports more remote sources or more versions of remote sources than SDA.

The following figure shows the SDI supported remote sources for SAP HANA SDI 2.0 SP04. For more information,
please see SAP HANA SDI and all its patches Product Availability Matrix (PAM) .

March 2021 4
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

2.2.4 Advantages of Using SAP HANA Smart Data Access


When using SAP HANA Smart Data Access for query access to data in remote databases, it offers the following
advantages:
• Support your business decisions with live analytics
• No replication of authorization models and authorization model always up to date
• Adding hierarchical analysis to originally flat data

2.2.4.1 Live Analytics

In the world of analytics, real-time reporting has been sought after for the last decade. With SAP HANA SDA, SAP
HANA acts as a single gateway to all your data and allows SAC to pull data from calculation views to provide real-time
reporting for decision makers. HANA’s in-memory analytics is the game changer that makes this possible, delivering
rapid access to visually rich data that can be interactively explored and quickly analyzed. SAP HANA doesn’t replicate
any data from the remote databases and stimulates the performance considering the whole thing is completed under
the seamless platform. Hence, the business users can leverage SAP HANA SDA to explore the accountable insights
and make decisions with confidence in SAP Analytics Cloud.

2.2.4.2 Row-level Security

Using SAP HANA SDA to access remote databases requires near-zero additional maintenance on user authorizations.
The row level security is centrally managed in the remote databases. Neither SAC nor HANA replicates the authorization
models from Remote Database.
The user credentials for remote database must be specified when you configure HANA SDA to connect to the remote
database. Connections to the remote data source can be authenticated as follows:
• Technical user – All connections to the remote databases share the same credential for the database. Specify
a valid remote user and password to connect to the remote database.
• Secondary credentials – One credential per user per data source setup beforehand

March 2021 5
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

• SSO (Kerberos) – All connections to remote database (SAP HANA remote databases only) are authenticated
through Kerberos single sign-on (SSO)
All credentials are stored securely in SAP HANA's internal credential store. SSO with Kerberos is a recommended
authentication method because the row level security implemented at the source data will always be respected for
each user.

2.2.4.3 Additional Value

SAP HANA is not just a data gateway to remote sources. For example, HANA is able to add hierarchies on flat data
structure in source tables. This additional value is very important because it allows SAC to perform drill down analysis.
SAP HANA supports both parent-child hierarchy and level-based hierarchy, and both can be consumed by SAC. Apart
from exposing data from various remote sources in the form of virtual tables, SDA allows to combine these data with
data resides in the HANA physical tables using HANA models. The feasibility to apply HANA planning, predictive as well
as text search algorithm with the combined dataset provides an outstanding benefit to the customers and business.

March 2021 6
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

3. Setup Live Data Connection to SQL Server Using HANA Smart


Data Access
In this section, we will take Microsoft SQL Server as an example remote database and setup SAC live data connection
to Microsoft SQL Server using SAP HANA SDA. Firstly, we need to setup SQL Server ODBC driver to ensure that
SAP HANA can access SQL Server through ODBC protocol. In SAP HANA, we create virtual tables that point to the
tables in SQL Server, and then use the virtual tables to create calculation views, which can be consumed in SAC.
Lastly, SAC establishes a live data connection to SAP HANA and eventually visualized the SQL Server data. The
system landscape is setup as below.

To test the live connection to SQL Server, we created a sample database in SQL Server. The sample database
contains three tables: CountryCode, Sales, and Region under the one schema. The following figure illustrates the
sample database diagram. The following tables are not provided in this documentation. You may use any similar
tables in your database to create a calculation view in this exercise.

March 2021 7
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

3.1 Setup SQL Server ODBC Driver

Explanation Screenshot

1. On the SAP HANA host, logged


on as the SAP HANA software
owner (<sid>adm), install the
Microsoft ODBC driver.

URL:
https://docs.microsoft.com/en-
gb/sql/connect/odbc/linux-
mac/installing-the-microsoft-
odbc-driver-for-sql-
server?view=sql-server-
2017#microsoft-odbc-driver-
131-for-sql-server

The above documentation


explains how to install the
Microsoft ODBC driver 17 from
the bash shell for different
Linux distributions.

Note: The driver installation


creates the following directory:
/opt/microsoft/msodbcsql/lib64.

Look for the commands for your


OS version.

2. Run the specified commands in


bash shell.

March 2021 8
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

3. Go to unixODBC Project home


page: http://www.unixodbc.org/

Download and install the


unixODBC driver manger as
specified by SQL Server.

4. Once the unixODBC driver


manager is installed, check if it
is installed properly by checking
the installed version.

5. Change to <sid>adm $HOME


directory.

6. Use vi as the editor, and create


a file named .customer.sh by
issuing the command
vi .customer.sh

Add the following lines to the


file:

export
LD_LIBRARY_PATH=$LD_LIB
RARY_PATH:/opt/microsoft/ms
odbcsql/lib64

March 2021 9
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

export
LD_LIBRARY_PATH=$LD_LIB
RARY_PATH:/usr/local/lib64

Your .customer.sh file should


look like the one in the
screenshot.

To Save the file hit the Escape


key on keyboard and type :wq

7. Restart the SAP HANA system


to apply the change to
the .customer.sh file by issuing
the following commands:

HDB stop
HDB start

8. Check if the path has been


added to the environment
LD_LIBRARY_PATH by issuing
the following command:

echo $LD_LIBRARY_PATH

9. Use vi as the editor, and create


a DSN entry named .odbc.ini by
issuing the command
vi .odbc.ini

Fill in the details using the


following template:

[<Data Source Name>]


Description(Optional) = <A brief
description of the DSN entry>

March 2021 10
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

Server =
<client_ip_address>:<sqlserver
_port>
Driver=
/opt/microsoft/msodbcsql/lib64/
<library_file>
Database=<Specified Database
Name>

Your DSN entry should look like


the one in the screenshot.

To Save the file hit the Escape


key on keyboard and type :wq

10. Restart your HANA server to


apply the changes in DSN entry

The commands:

HDB stop

HDB start

11. Test the ODBC connection by


issuing the command

isql -v <Data Source Name>


<user> <password>

March 2021 11
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

3.2 Add SQL Server as a Remote Source


Next, we will add the SQL Server as a remote source in SAP HANA Studio. The following privileges are required to
manage remote sources and virtual tables:

• System privileges: CREATE REMOTE SOURCE, CREDENTIAL ADMIN


• Object privilege: CREATE VIRTUAL TABLE

Explanation Screenshot

12. Logon to the HANA system in


HANA studio.

13. Go to Provisioning -> Remote


Source
14. Right click on the Remote
Source and Create a New
Remote Source

March 2021 12
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

15. Fill in the remote source details:

Source Name
Adapter Name: MSSQL
(GENERIC ODBC)
Data Source Name
Credentials Mode: Technical
user
User Name
Password

Note: You can select other


Credentials Modes such as
None(Kerberos).

Save the remote source.

16. Now, you can see the SQL


Server in the list of Remote
Source.

17. Expand dbo to see all the


tables under schema dbo.
18. Right click on a table and Add
as Virtual Table

March 2021 13
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

19. Give the Virtual Table a name


and select a schema to create
the table.

20. Repeat the above steps to add


all the necessary virtual tables.
Once the virtual table is
created, it will appear in the
tables of the selected schema.

March 2021 14
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

3.3 Create a Calculation View with the Virtual Tables from SQL Server
In this section, we will use the virtual tables from SQL Server to create a calculation view in HANA studio. The SQL
Server tables in this section are not provided. You will need three tables with relations to construct a similar calculation
view.

You need to grant select on SCHEMA to related users by executing the following statement in SQL console:
GRANT SELECT ON SCHEMA <Your_Schema_Name> TO _SYS_REPO WITH GRANT OPTION

Explanation Screenshot

21. Create a new package in


Content.

March 2021 15
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

22. Create a new Calculation View


under the package.

23. Enter a Name.


24. Click Finish.

March 2021 16
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

25. Build a calculation view using


the virtual tables created in last
section.
26. Click Semantics.
27. Select ‘Measure’ or ‘Dimension’
as the type of each column.

28. Click on View Properties.


29. Change the parameter Execute
In to ‘SQL Engine’.

Note: The parameter Execute in


‘SQL Engine’ improves the
performance of HANA calculation
views using by SAC. This will be
discussed in detail in the next
section.

30. Click on Hierarchies.


31. Create a new hierarchy.

March 2021 17
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

32. Create a new Hierarchy as


shown in screenshot.
33. Click OK.

34. Save and Activate the


calculation view.

3.4 Create a story in SAP Analytics Cloud using Live Data Connection to
HANA
In this section, we will create an SAC model using the HANA calculation view created in last section, and create an SAC
story on top of the SAC model. The live data connection to your HANA system is a prerequisite in this section. This
section will not include how to create a live data connection to your HANA system in this session.

Explanation Screenshot

March 2021 18
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

35. Logon to your SAP Analytics


Cloud tenant.
36. Click on the Main Menu

37. Select Create -> Model

March 2021 19
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

38. Click on Get data from a data


source
39. Click on Live Data Connection

40. Enter the following information


System Type: SAP HANA
Connection: your HANA system
connection
Data Source:
YOUR_VIEW_NAME

41. Click OK

42. Save as a new Model

March 2021 20
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

43. Provide the new Model a name


and save it in a directory.

44. Click on Main Menu


45. Select Create -> Story

March 2021 21
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

46. Select Add a Responsive Page

47. Remove one of the responsive


pages.

48. Insert a Chart.

49. Select the model.

March 2021 22
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

50. Select Unit_Cost and


Unit_Price as the measures,
and the hierarchy Region_Lbh
as the Dimension.
The chart looks like the
screenshot.

51. Click on the bar.


52. Click on the Drill Down.

Note: This drill-down analysis is


enabled by the hierarchy created in
HANA. This is an added value that
HANA can build hierarchies on flat
data structure in source tables.

53. The chart will show based on


the regions.
54. Save the story.

March 2021 23
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

3.5 Best Practices of SAP HANA SDA Modeling


SAP HANA Smart Data Access optimizes execution of queries by moving processing as much as possible to the
database connected via SAP HANA Smart Data Access. The SQL queries then work in SAP HANA on virtual tables.
The SAP HANA Query Processor optimizes the queries and executes the relevant part in the connected database, only
minor datasets are moved across the remote network to complete the operation.

When Calculation Views are included in queries, the query is first optimized in a special engine called “Calculation
Engine”. This has a drawback when the query is included in a larger SQL query, because in this case two different
optimization processes are involved: One for the SQL query part and the other one for the Calculation View part. This
can lead to inefficiencies between the different optimization processes.

To avoid these inefficiencies, you can set the parameter “Execute in” to “SQL Engine” in Calculation Views. This can
push as much processing as possible to target data source. One exception is that this setting is active for Cubes with
Star Joins automatically even though the “Execute in” option is not set to “SQL Engine”. MDS queries often benefit from
setting the flag to “SQL Engine” in the topmost Calculation Views that are queried by MDS. SAP Analytics Cloud utilizes
MDS queries to retrieve the data from HANA Calculation Views.

An experiment is conducted to compare the MDS query runtime with the parameter “Execute in” to “SQL Engine”. Before
the parameter “Execute in” is set to “SQL Engine”, the MDS query runtime is around 18.54 seconds, which is very slow
in live analytics. In SAP HANA, the query selects 1 million records of table Sales and 7 records of table Region back
from SQL Server, and processes the query in SAP HANA. In SQL Server, most of the 18.54 seconds are spent on
processing the SELECT statement on 1 million records of table Sales. After the parameter “Execute in” is set to “SQL
Engine”, the same MDS query only costs 0.79 second, In SAP HANA, the query is pushed down to SQL Server, and it
significantly reduces the data transfer from SQL Server to HANA, specifically, only 7 records are returned to HANA. This
is a huge performance improvement in MDS query runtime.

On the other side, the overall performance also relies on the performance of query processing in SQL Server. SQL
performance tuning can be an incredibly difficult task, particularly when working with large-scale data where even the
most minor change can have a dramatic impact on performance. There are many tips for database tuning and
performance optimization: indexes, optimizer hints, columnstore index, query store, etc.

March 2021 24
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

Another experiment is conducted to improve the SQL query runtime with adding an optimized index for table Sales in
SQL Server. Before adding the optimized row index for table Sales, the SQL query runtime is around 1.89 seconds,
while the runtime drops to 0.68 second with the optimized row index.

This experiment demonstrates the performance should be also optimized in the remote database. There are many other
modern database technologies that can improve the performance in remote database. The faster the data can be
transferred from remote databases to SAP HANA, the better live analytics we will have.

March 2021 25
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

4. Setup Live Data Connection to S/4HANA Using HANA Smart


Data Integration
In this section, we will setup SAC live data connection to S/4HANA using SAP HANA SDI. In the previous sections, we
have configured SAC live data connection to SQL Server using SAP HANA SDA. With the help of SDA, SAP HANA can
communicate with the databases which support the ODBC protocol. For other remote sources or other versions of
remote sources than those supported by SDA, SDI extends SDA’s virtualization capabilities and adapter options. ABAP
adapter is one of the adapters that is supported by SDI. ABAP adapter allows SAP HANA to connect to any version of
SAP ERP systems.

Currently, SAP Analytics Cloud only has acquired data connection to SAP ERP systems. With SAP HANA SDI, SAC
can live connect to SAP ERP systems. The system landscape is started with installing and configuring Data Provisioning
Agent. The ABAP adapter not only enables virtual tables mapping to the ABAP tables, but virtual procedures mapping
to the BAPIs in SAP ERP. Both virtual tables and virtual procedures can be used to create calculation views in SAP
HANA, and then SAC consumes the calculation views through live data connection to SAP HANA. The system
landscape is setup as below.

Since ABAP adapter exposes three types of data: ABAP tables, BAPIs, and ODP extractors to SAP HANA, it is important
to decide which types of data can be used in this scenario. The ODP extractors includes CDS views, BW, and HANA,
SAC already has live data connection to these data sources. Thus, ODP extractors can be excluded in this scenario.
Again, the rule of thumb is to reduce the data transfer across the network. In this case, it is to push down as much
processing as possible to SAP ERP’s database. SAP AS ABAP cannot process SQL query from HANA, so HANA cannot
push down query processing to SAP ERP. That means the raw query result on virtual tables mapped to ABAP tables
need to be returned to SAP HANA, which will cause poor performance if the size of the ABAP tables is too large. Thus,
the only option is to use BAPIs in SAP ERP. BAPIs can push the query down to SAP ERP’s database if coded
accordingly, and return the aggregated result set to SAP HANA.

March 2021 26
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

4.1 Install and Configure SAP Data Provisioning Agent


In this section, we will install and configure the data provisioning agent with ABAP Adapter.

Explanation Screenshot

1. Data Provisioning Agent


Planning and Preparation.
a. Supported Platforms and
System Requirements
b. Software Download
2. Download SAP HANA SDI 2.0
and extract the software to an
empty directory

3. Navigate to the directory where


you unpacked the software and
execute hdbsetup.exe

Assign a folder name for the


new SAP HANA DATA
Provisioning Agent and click
Next

March 2021 27
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

4. Fill up all the mandatory fields,


Modify the Agent Listener Port,
Agent Administration Port, and
Customer JRE directory if
needed and click Next

5. Click Install and Finish the


installation

6. Open an Administrator prompt


on the Windows where the DP
agent is installed
Note: <DPAgent_root> is the
directory where the DP agent was
installed. By default, on Windows,

March 2021 28
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

this is C:\usr\sap\dataprovagent,
and on Linux it is
/usr/sap/dataprovagent.

7. Start the Data Provisioning


Agent: You must start the
agent, if it has not been started
already: Select option 2. Start
or Stop Agent, and then option
1. Start Agent.
Select b. Back to go back to
the main menu.
<DPAgent_root>\bin\agentcl
i.bat --configAgent

8. Select option 6. SAP HANA


Connection

9. Select option 2. Connect to


SAP HANA on Premise (TCP)

Specify the hostname, port, and


Agent Admin HANA User
credentials for the SAP HANA
server as prompted.

Select b. Back to go back to


the main menu.

March 2021 29
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

10. Select option 7. Agent


Registration

11. Select option 1. Register


Agent

Specify the agent connection


information as prompted.

Select b. Back to go back to


the main menu.

12. Select option 8. Adapter


Registration
13. Select option 2. Register
Adapter
14. Enter adapter name:
ABAPAdapter

The adapter name must match


the name displayed by the
Display Adapters option.

March 2021 30
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

4.2 Add S/4HANA as a Remote Source


In this section, we will connect to SAP S/4HANA using the ABAP Adapter in HANA Smart Data Integration.

Explanation Screenshot

15. Logon to the HANA system in


HANA studio.

16. Go to Provisioning -> Remote


Source

17. Right click on the Remote


Source and Create a New
Remote Source

March 2021 31
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

18. Fill in the remote source details:

Source Name
Adapter Name: ABAP Adapter
Application Server
Client
Instance Number

Credentials Mode: Technical


user
User Name
Password

Note: You can select other


Credentials Modes such as
None(Kerberos).

19. Save the remote source.

20. Now, you can see S/4HANA


system RI4 in the list of Remote
Source.

March 2021 32
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

4.3 Create Custom BAPIs in SAP S/4HANA


In this section, we will first create a structure in SAP NetWeaver AS ABAP, and then create a function module to return
the aggregated data back from S/4HANA’s database. Lastly, we will add this function module into a custom BAPI.

Explanation Screenshot

21. Logon S/4HANA in SAPGUI.

22. Go to transaction SE11.

23. Select Data type.

24. Enter a custom BAPI name.

25. Click Create.

March 2021 33
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

26. Select Structure.

27. Click OK.

28. Enter a Short Description.

29. Enter the Component (Field


Name) and Component Type
(Data Element) as shown in the
screenshot.

Note: Here the component names


start with Z as per the SAP
recommendation. Let's use data
elements that we have already
created in the database table
VBAK.

30. Enter the Package Z001.

31. Save the structure.

March 2021 34
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

32. Click OK.

33. Activate the structure.

34. Go to transaction SE37.

35. Enter a new Function Module


name.

36. Click Create.

37. Enter Function group.

38. Enter a Short description.

Note: If function group is not


already made, you could create it
by following steps 39-41.

March 2021 35
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

39. Go to More -> Goto -> Function


Groups -> Create Group.

40. Enter a Short description.

41. Save the Function Group.

42. Enter a Package.

43. Click Save.

March 2021 36
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

44. Click on Import.

45. Add VBTYP as a import


parameter.

46. Click on Export.

47. Add RETURN as a export


parameter.

48. Click on Table.

49. Add ITEMTAB as a table, the


Associated Type is the
structure ZBAPISTRVBAK.

50. Click on Source code.

51. Enter the following code:

SELECT vbtyp ernam SUM(


netwr )
FROM vbak
INTO TABLE itemtab
WHERE vbtyp = vbtyp
GROUP BY ernam vbtyp.

Note: The above ABAP code is to


push the aggregation to the
S/4HANA’s database. Retrieving
the aggregated result is critical for
performance.

52. Click Save.

March 2021 37
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

53. Activate the Function Module.

54. Go back.

55. Release the function module by


More -> Function Module ->
Release -> Release.

56. Go to transaction SWO1.

57. enter the name of the custom


BAPI.

58. Click Create.

March 2021 38
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

59. Enter the details as shown in


the screenshot.

60. Click Save.

61. Enter a package Z001.

62. Click Save.

63. Click OK.

March 2021 39
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

64. Select More -> Utilities -> API


Methods -> Add Method.

Note: There would be two methods,


showing in red color which comes
by default while creating the BAPI.

65. Enter Function module name.

66. Click OK.

67. Click Next.

March 2021 40
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

68. Click Next.

69. Click Yes.

70. Now the API method has been


added.

71. Double click on the API


method.

March 2021 41
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

72. Select API Function.

73. Click Save.

74. Click Save.

March 2021 42
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

75. Select the Object


“ZBAPI_KEV”.

76. Go to More -> Edit -> Change


Release Status -> Object type -
-> To modeled.

77. Go to More -> Edit -> Change


Release Status -> Object type -
-> To implemented.

78. Go to More -> Edit -> Change


Release Status -> Object type -
-> To released.

March 2021 43
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

79. Select the API method.

80. Go to More -> Edit -> Change


Release Status -> Object type
component -> To modeled.

81. Go to More -> Edit -> Change


Release Status -> Object type
component -> To implemented.

March 2021 44
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

82. Go to More -> Edit -> Change


Release Status -> Object type
component -> To released.

83. Click Generate.

March 2021 45
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

84. Go to transaction BAPI.

85. Click on Alphabetical.

86. Find your BAPI as shown in the


screenshot.

4.4 Create a Calculation View with the Virtual Procedure from S/4HANA
In this section, we will create a virtual procedure in HANA pointing to the BAPI in S/4HANA. With this virtual procedure,
we will create a calculation view in HANA.

Explanation Screenshot

87. Navigate to SAP HANA Web


IDE using the following link:

https://<Hostname>:<Port>/sap
/hana/ide/catalog/

Note: Virtual procedures can only


be created in SAP HANA Web IDE.

March 2021 46
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

88. Select BAPI Procedures -> Z…


-> ZBAPI_VBAK_TOTAL.

89. Create a New Virtual


Procedure.

90. Select the Schema you like to


add the virtual Procedure.

91. Select Catalog -> YourSchema


-> Procedures ->
RI4_ZBAPI_VBAK_TOTAL

March 2021 47
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

92. Open the definition of


RI4_ZBAPI_VBAK_TOTAL

Note: The parameter types will be


needed to create Calculation Views
in HANA studio.

93. Go back to HANA Studio.

94. Create a new table.

95. Enter the table name


ITEMTAB_IN.

96. Create the columns as the


definition of table parameter in
the virtual procedure.

97. Save.

March 2021 48
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

98. Create a new Calculation View


under a package.

99. Enter a Name.

100. Select SQL Script as the


Type.

101. Click Finish.

102. Create the Script_View BEGIN


using the script on the right. declare i1 NVARCHAR(1) :='C';

declare o1 NVARCHAR (1);


Note: i1 is the input parameter, declare o2 NVARCHAR (20);
o1~o14 are the output parameters. declare o3 NVARCHAR (3);
The parameter types are copied declare o4 NVARCHAR (220);
declare o5 NVARCHAR (20);
from the definition of the virtual
declare o6 NVARCHAR (6);
procedure. declare o7 NVARCHAR (50);
declare o8 NVARCHAR (50);

March 2021 49
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

declare o9 NVARCHAR (50);


declare o10 NVARCHAR (50);
declare o11 NVARCHAR (32);
declare o12 INTEGER;
declare o13 NVARCHAR (30);
declare o14 NVARCHAR (10);

ITEMTAB_IN = select * from "I841302"."ITEMTAB_IN";

call "I841302"."RI4_ZBAPI_VBAK_TOTAL"(i1,o1, o2, o3, o4,


o5, o6, o7, o8, o9,o10,o11,o12,o13,o14,
:ITEMTAB_IN,ITEMTAB_OUT);

var_out=SELECT * FROM :ITEMTAB_OUT;

END

103. Click on Semantics.

104. Assign the columns as


Measures/Dimensions.

105. Save and Activate the


Calculation View.

4.5 Create a story in SAP Analytics Cloud

Explanation Screenshot

March 2021 50
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

106. Logon to your SAP


Analytics Cloud tenant.

107. Click on the Main Menu.

108. Select Create -> Model.

March 2021 51
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

109. Click on Get data from a


data source.

110. Click on Live Data


Connection.

111. Enter the following


information
System Type: SAP HANA
Connection: HI4 or your HANA
system connection
Data Source:
ZBAPI_VBAK_TOTAL

112. Click OK.

113. Save the model.

March 2021 52
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

114. Provide the new Model a


name and save it in a directory.

115. Click on Main Menu


116. Select Create -> Story

March 2021 53
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

117. Select Add a Responsive


Page.

118. Remove one of the


responsive pages.

119. Insert a Chart.

120. Select the model


ZBAPI_VBAK_TOTAL.

March 2021 54
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

121. Select NETWR as


Measures.
122. Select ERNAM as
Dimensions.

123. The chart look should like


the screenshot.
124. Save the story.

Note: The screenshot below


compares the aggregated BAPI call
to the non-aggregated. The
performance of aggregated BAPI
call is over 90% faster than the
non-aggregated.

Non-aggregation: 148,000
records moved from ABAP server
to HANA takes ~6 seconds.
Aggregation: 102 records moved
from ABAP Server to HANA takes
0.5 second.

March 2021 55
SAC: Setup Live Data Connection using SAP HANA Smart Data Access

5. Current Limitations
This chapter covers the current limitations of SAC live connectivity using HANA 2.0 as a data gateway to remote
sources.

5.1 Building Calculation Views in SAP HANA


Compare to the existing live data connectivity in SAC, HANA data modeling is an extra effort that must be invested by
modelers. In order to have live analytics on the remote source, you must know how to build calculation views in SAP
HANA using the virtual tables or virtual procedures.

5.2 Creating Custom BAPIs in SAP NetWeaver AS ABAP


Custom BAPIs need to be developed in most use cases. The performance best practice requires BAPIs to return
aggregated results for optimal performance, however, very few existing BAPIs return aggregated results. Creating
custom BAPIs requires some ABAP programming knowledge and effort. Whereas in general, it is not difficult to create
custom BAPIs returning the aggregated results.

March 2021 56
https://www.sap.com/registration/cont
act.html

https://www.sapanalytics.cloud/
https://help.sap.com/viewer/product/S
AP_ANALYTICS_CLOUD

© 2016 SAP SE or an SAP affiliate company. 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 SE or an SAP affiliate company. The information
contained herein may be changed without prior notice.
Some software products marketed by SAP SE and its
distributors contain proprietary software components of other
software vendors. National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate
company for informational purposes only, without
representation or warranty of any kind, and SAP or its
affiliated companies shall not be liable for errors or omissions
with respect to the materials. The only warranties for SAP or
SAP affiliate company products and services are those that are
set forth in the express warranty statements accompanying
such products and services, if any. Nothing herein should be
construed as constituting an additional warranty.
SAP and other SAP products and services mentioned herein as
well as their respective logos are trademarks or registered
trademarks of SAP SE (or an SAP affiliate company) in
Germany and other countries. All other product and service
names mentioned are the trademarks of their respective
companies.

Please see http://www.sap.com/corporate-

en/legal/copyright/index.epx for additional trademark information

and notices.

You might also like