SAP Analytics Cloud - Setup Live Data Connection Using SAP HANA Smart Data Access
SAP Analytics Cloud - Setup Live Data Connection Using SAP HANA Smart Data Access
Applicable Releases:
SAP Analytics Cloud
SAP HANA 2.0 SP00 and above
Version 1.10
March 2021
Document History
Document Version Description
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.
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
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.
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
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.
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.
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
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
Explanation Screenshot
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
March 2021 8
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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
HDB stop
HDB start
echo $LD_LIBRARY_PATH
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>
The commands:
HDB stop
HDB start
March 2021 11
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
Explanation Screenshot
March 2021 12
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
Source Name
Adapter Name: MSSQL
(GENERIC ODBC)
Data Source Name
Credentials Mode: Technical
user
User Name
Password
March 2021 13
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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
March 2021 15
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 16
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 17
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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
March 2021 19
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
41. Click OK
March 2021 20
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 21
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 22
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 23
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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
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
Explanation Screenshot
March 2021 27
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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.
March 2021 29
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 30
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
Explanation Screenshot
March 2021 31
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
Source Name
Adapter Name: ABAP Adapter
Application Server
Client
Instance Number
March 2021 32
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
Explanation Screenshot
March 2021 33
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 34
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 35
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 36
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 37
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
54. Go back.
March 2021 38
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 39
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 40
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 41
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 42
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 43
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 44
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 45
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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
https://<Hostname>:<Port>/sap
/hana/ide/catalog/
March 2021 46
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 47
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
97. Save.
March 2021 48
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 49
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
END
Explanation Screenshot
March 2021 50
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 51
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 52
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 53
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
March 2021 54
SAC: Setup Live Data Connection using SAP HANA Smart Data Access
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.
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
and notices.