When you are building a calculation view, SAP Business Application Studio allows you to use a feature called Data Preview to check the results.
There are two ways to display a data preview:
- Right-click the top node of an open calculation view and choose Data Preview.
- Right-click any deployed calculation view in the Explorer pane and choose Data Preview.
This Is particularly useful to preview data from a calculation view that is not currently open.
The embedded data preview in SAP Business Application Studio mentioned above is an equivalent to the data preview included in another SAP HANA Cloud tool: Database Explorer. This tool can be launched from the Explorer window, in the SAP HANA Projects pane. Choose the root element (this is the database module, for example HC300/db), and choose Open HDI Container.
In the data preview, you can view the SQL code that generated the results. This is a simple SQL query that selects all columns of the calculation view, with no filters. The statement includes all aggregate functions defined In the top view node, if any. You can edit the query to remove columns or add filters, and so on, in order to test the calculation view against different query conditions.
Watch this video to learn about the Standard Preview or Custom SQL Query.
Standard Data Preview Features
Even though the Database Explorer is not a reporting tool, it still offers analysis functionality that can be useful during modeling or troubleshooting. It is comprised of the following tabs, each offering specific capabilities:
Database Explorer Tabs
|Raw Data||All data||Basic display of contents|
|Hierarchies||Data for a Selected SQL Hierarchy||Preview of a modeled SQL hierarchy|
|Analysis||Selected attributes and measures in tables or graphs||Profiling and analysis|
Choosing the User who Executes the Data Preview
Up to SAP HANA Cloud QRC 3/2021, the data preview triggered from within the Calculation View editor (by right-clicking the up-most node, below the Semantics node) or right-clicking a design-time object in the DB module structure, was executed with a technical user ..._RT who has, by default, extensive privileges on the container's objects plus all the privileges granted to the application user in case an external schema or container is accessed.
Since QRC 4/2021, from the Calculation View editor, it is possible to choose whether you want to trigger the data preview with this ..._RT user (Data Preview) or another user (Data Preview With Other Database User). This allows you to apply session contexts (client values, analytic privileges, and so on).
You must choose the other database user among the users referenced in connections defined in the Database Explorer. In particular, to query a calculation view with a standard database user, this user must be assigned to an SAP HANA Database (it is not possible to add an HDI container with another user than the ..._RT user).
You can find more information about users and security in the section, Implementing Security in SAP HANA Modeling, of this course.
Manual vs. Automatic Data Preview Query Execution
Up to SAP HANA Cloud QRC 4/2021, upon data preview, the default query is automatically executed.
Starting with SAP HANA Cloud QRC 1/2022, a general option in SAP Business Application Studio allows you to decide whether the query is executed automatically, or needs to be triggered manually. This new option allows you to avoid the automatic execution of an expensive query during data preview, especially when you want to adapt the query before executing it.
Data Preview: SQL Hierarchies
SAP HANA Cloud QRC 1/2022 brings in a new capability for Data Preview: SQL Hierarchies modeled in a Calculation View can be visualized within SAP Business Application Studio Data Preview.
It allows you to easily check the modeled hierarchies without using an external and / or third-party tool. You can also display and copy the SQL statement used to navigate the hierarchy.