Checking the Output of a Calculation View

Objective

After completing this lesson, you will be able to check the output of a calculation view to ensure correct results are generated

Checking the Output of a Calculation View

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

TabDisplaysUse Case
Raw DataAll dataBasic display of contents
HierarchiesData for a Selected SQL HierarchyPreview of a modeled SQL hierarchy
AnalysisSelected attributes and measures in tables or graphsProfiling 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).

Screen capture of the context menu on an Aggregation node with entry Data Preview with Other Database User. See text before and after the image for details.

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.

Note

To avoid Data Preview delay, the list of Database Explorer connection is not filtered. Make sure to choose a relevant connection, that is, one made with a user who has access to the HDI Container schema.

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.

Hint

To find the setting easily, in the preferences of SAP Business Application Studio, search for Manual Refresh. Note that you can have different settings in each development space, and you can also specify the option at the User or Workspace level.

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.

Screen capture of the preview of a geographical hierarchy structure and its data. The root node (all) is expanded to regions (Europe, North America), to countries (DE, ES, FR, GB) and to provinces). A button SQL at the top right allows you to display the SQL hierarchy query statement.

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.

Log in to track your progress & complete quizzes