Generating Calculation Views from SAP BW/4HANA Models

Objectives

After completing this lesson, you will be able to:

  • Consume an SAP BW/4HANA-generated calculation view in an SAP HANA model

Generating External SAP HANA Calculation Views from SAP BW/4HANA Objects

Generate External SAP HANA Calculation Views

In SAP BW/4HANA, you can automatically generate SAP HANA Calculation Views for the following SAP BW/4HANA objects:

  • DataStore Object (advanced)
  • CompositeProvider
  • InfoObject Characteristic
  • BW Query
  • Local CompositeProvider of BW Workspace

A generated calculation view exposes the SAP BW/4HANA model to SAP HANA's modeling environment.

Here are some use cases:

  • Consume SAP BW/4HANA data with native SQL front ends or clients not able to consume BW Queries

  • Consume SAP BW/4HANA data completely independent of the services and governance of SAP BW/4HANA application

  • Consume SAP BW/4HANA data and manage access with native SAP HANA concepts (SAP HANA privileges, lifecycle management and so on

  • Leverage SAP HANA calculations or transformation functions that are more powerful and/or easier to implement in native SAP HANA compared to SAP BW/4HANA

The automatic generation of SAP HANA calculation views occurs during the activation of the SAP BW/4HANA object, if the setting in the property External SAP HANA Views is enabled.

The generated calculation views point directly to the same data and tables of the corresponding SAP BW/4HANA object. These tables are located in the BW-managed SAP HANA schema.

Hint

Direct consumption of SAP BW/4HANA-owned tables by SAP HANA calculation views is not supported. For more information, check SAP note 1682131: SAP BW tables in SAP HANA Information Views and ABAP CDS Views not supported

It is important to note that the generated calculation views are based on XS classic. There is no HDI calculation view generation available (see SAP note 2463312).

Although it might seem neater to have a single environment for HANA calculation views, there is no significant benefit for SAP BW/4HANA to have its calculation views generated in XSA and XSC is sufficient. Please remember, you should never directly adjust the generated calculation views in SAP HANA as they are generated from SAP BW/4HANA. You could use SAP HANA Studio to display the generated calculation views. Also, with some configuration, you can access the generated calculation views in your XSA modeling projects. For example, a calculation view in XSA can consume any calculation view in XS Classic, regardless of whether it is generated or manually created.

Note

Later in this lesson you learn about the prerequisites to use SAP HANA classic calculation views in XSA modeling scenarios.

The generated SAP HANA calculation views are managed in a predefined SAP HANA Content Package. These calculation views are transported with the corresponding InfoProviders and they are generated in the SAP HANA database of the target SAP BW/4HANA-system based on the "External SAP HANA View" setting in the modeling properties.

Note

Do not change generated SAP HANA views manually because the external SAP HANA Calculation Views may be overwritten at any time by the system. This means that any manual changes would be lost. You can, however, create customer SAP HANA calculation views, which consume these objects to define stable customer logic.

Also take into consideration, that it is not supported to use the generated external SAP HANA Views directly inside the SAP BW/4HANA CompositeProvider. Instead, you must use the original SAP BW/4HANA object as a PartProvider (refer to SAP note 2458572).

Restrictions of External SAP HANA Views

Not all SAP BW/4HANA InfoProvider properties can be added to the generated SAP HANA Calculation Views. The following properties are not supported:

  • ALPHA conversion and date conversion
  • Display attributes
  • Noncumulative key figures are only supported in the SAP HANA view for queries
  • Key figures, for which the aggregation is set to No Aggregation
  • Key figures of data type date or time related to aggregation SUM
  • For information on restrictions regarding data on Cold storage, see SAP note 2032797.
  • Additional restrictions for InfoObjects are as follows:
    • It must be a characteristic with master data and texts.
    • The master data access must be standard or SAP HANA View.
    • The Attribute only checkbox has not been selected.
    • The InfoObject must not have any navigation attributes that are authorization-relevant and whose master data access is not standard.
    • Compound characteristics are added as simple InfoObjects; the compounding property is lost, and there are no concatenated values.
    • The key date for time-dependent attributes and texts is specified using the input parameter keydate of the SAP HANA view. If this parameter is not explicitly supplied with data when the access occurs, the current day is used. The format of the parameter is YYYYMMDD, which corresponds to ABAP type DATS.

SAP HANA View Generation for SAP BW Queries

Queries are compiled by the analytic manager into an optimized execution plan. This means that most parts are executed in SAP HANA, and only a small part in the SAP BW application server. In many cases, the result set is complex and multidimensional.

In some cases, however, the query result is displayed as a flat view and can be fully calculated in SAP HANA. For these queries, an SAP HANA Calculation View can be generated from SAP BW. This view can be used with SAP HANA native interfaces such as SQL.

An SAP HANA Calculation View, which has been created from its SAP BW query, cannot be compared to other query interfaces such as BICS. This is because the SAP HANA Calculation View cannot perform any calculations such as hierarchies, zero suppression, or local calculations, which are normally performed on the SAP BW application server. Therefore, there is no guarantee that the result of the SAP HANA Calculation View will be exactly the same as the result of the query executed on the SAP BW/4HANA application server. Here, the restrictions of the SAP HANA view of the InfoProvider, which the query is based on, also apply to the query. If you change the query in the SAP BW modeling tools, the associated SAP HANA view is automatically updated. However, the global elements are not updated. If global elements are changed, these elements are only changed in the query, once the query is activated again. The associated SAP HANA view is also updated.

There are additional restrictions for generating external SAP HANA Calculation Views for queries. The following query features are ignored, but the external HANA View can still be generated (but without these features):

  • Hierarchy display settings
  • Default values for characteristics
  • Structures
  • Conditions
  • Exceptions
  • Local calculations
  • Display options (for example, the number of decimal places)
  • Zero suppression
  • Additional query properties (cache mode, read mode, near-line storage mode)
  • Hidden key figures
  • Display attributes
  • Stable data during navigation
  • Structures

For noncumulative key figures, see SAP note 2032830.

The following functions are not supported and impede the generation of external SAP HANA calculation views from queries:

  • Constant selection
  • Definitions on a cell
  • Exception aggregation
Note
The list is not exhaustive. Assume that anything not included in the list of supported SAP BW functions is not supported. If any of these functions are contained in the query, the SAP HANA calculation views cannot be generated.

Launch the next demo to explore the generation of an external SAP HANA calculation view for an InfoObject:

Generate an External SAP HANA View for an InfoObject

Administration and authorisation of generated SAP HANA Calculation Views

Administration of External SAP HANA Views

In SAP BW/4HANA, the SAP GUI transaction RS2HANA_ADMIN provides you with an overview of all SAP BW/4HANA objects with an external SAP HANA view throughout the entire system, together with various administration and check functions. In Customizing, you can also make settings for authorizations for generating SAP HANA views.

  • Check external view
  • Repair external view
  • Log for repair jobs
  • Consistency check tool, mainly for authorization setup (transaction RS2HANA_CHECK)
  • General Settings of the customizing (transaction RS2HANA_VIEW), such as standard SAP HANA package or authorization assignment.

The same functions are also provided by the corresponding app Data Management / External SAP HANA Views in the SAP BW/4HANA Cockpit:

Authorization Management of External SAP HANA Views

When a query is executed on the SAP HANA Calculation View, the data is requested directly from SAP HANA, without the SAP BW ABAP layer being addressed at all. This means that SAP BW/4HANA features, like cache and OLAP engine, are not used. The same is valid for access control concepts: Authorizations are not managed by SAP BW/4HANA but by corresponding SAP HANA privileges.

When a calculation view is generated from SAP BW/4HANA, analytical privileges are automatically generated that correspond to the analysis authorizations from SAP BW/4HANA.

Before you generate the calculation views you need to define some important settings that will impact how the generation of privileges is handled.

In SAP HANA and SAP BW/4HANA, there are several prerequisites for proper setup of the generation of external SAP HANA Views.

In SAP HANA, to access SAP HANA views that have been generated from SAP BW/4HANA, you need the following authorizations:

  • Object privilege: SELECT on _SYS_BI Object privilege.
  • EXECUTE on REPOSITORY_REST(SYS) Package privilege.
  • REPO.READ on the content package where generated SAP HANA views are stored.
  • The session client must correspond to the SAP BW/4HANA system client. If you manage the authorization assignment in roles, this is valid only for the SAP<SID> user. If you prefer a direct assignment of privileges, it is required for all SAP HANA users who should be able to see data of the generated views.

The prerequisites in the SAP BW/4HANA Application for generating SAP HANA views from SAP BW/4HANA objects and using their data are as follows:

  • There must be an explicit assignment of SAP BW/4HANA Application user to SAP HANA user. Unlike SAP BW 7.x on SAP HANA, this mapping must be defined manually in the central user administration of SAP BW/4HANA.

    The preconditions for switching on the DBMS tab in the user maintenance (transaction SU01) are as follows:

    • Define a database connection in the DBCON table with the Change View Description of Database Connections: Overview (transaction DBCO) for the database user and database type HDB.

    • Maintain View USR_DBMS_SYSTEM in transaction SM30 to enhance SAP BW user maintenance (transaction SU01) with a new function DBMS to specify this assignment.

    The SAP HANA users can be created by the RSUSR_DBMS_USERS report. For details, see SAP note 1927767.

  • SAP BW/4HANA Analysis authorizations must be created. Define them for all characteristics flagged as authorization-relevant in the relevant InfoProvider. They must also contain all technical characteristics for the InfoProvider (0TCAVALID, 0TCAIPPROV), the key figures (0TCAKYFNM), and the activity (0TCAACTVT). Assign these Analysis authorizations to the SAP BW/4HANA user.

  • Define the assignment type and user mapping in SAP BW/4HANA image (transaction RS2HANA_VIEW or app in SAP BW/4HANA Cockpit: Data Management / External SAP HANA Views).

Hint

The transaction RS2HANA_CHECK validates whether all authorization settings are correct.

Using Generated SAP HANA Calculation Views in mixed modeling scenarios

As described already, be aware that the BW-generated Calculation Views are deployed in XS Classic and not in XS Advanced (HDI). As a consequence, BW-generated SAP HANA Calculation Views are not accessible to native SAP HANA modelers using the Web IDE for SAP HANA by default. Whereas the run-time objects of the native SAP HANA Calculation Views are located in container-owned schemas, the run-time objects of the BW-generated Calculation Views are always located in the SAP provided fixed schema _SYS_BIC. For this reason, without additional customizing they are out of reach of the HANA XSA developer's container. This means a HANA developer cannot immediately consume these BW-generated objects in a modern SAP HANA HDI / XSA Calculation View. For the traditional development based on SAP HANA XS classic, this was not the case and the BW-generated objects were immediately accessible to developers.

With some adjustments it is possible to provide the required access from a HDI Container to any HANA schema so that your SAP HANA Calculation Views can consume any objects across the entire database. This includes not just BW-generated SAP HANA Calculation Views but also tables, functions, and any other database objects.

To provide access there are some key steps to work through:

  1. Create a Cross-schema Service: This is done in the XSA Cockpit tool and is a one-time task usually taken care of by the system administrator. All developers can use the same Cross-schema Service. Within the service you specify a user that already possesses the full authorizations to access any of the objects that might be needed by a developer. Think of this user as the key holder with every key for all the locked rooms that anyone may want to access. This user will automatically grant you the access you need when you build your project by referring to a special file that describes the exact access you need (see next step).
  2. Define the precise Authorization for your project needs: This is done by creating a .HDBGRANTS source file within your XSA project. The file includes a list of all schemas that you should have access to. To access BW-generated SAP HANA Calculation Views you should include the _SYS_BIC schema. Think of this file as listing the rooms your actual project needs access to so that during the project build this file is used to tell the powerful user (step 1) what access it needs to grant to your project. But we haven't yet specified the exact Calculation Views we want to access just yet, just access to the schema (which basically means we now have access to any object in the schema).
  3. Define Synonyms that point to the specific run-time objects you want to access: In our case we should create synonyms that point to the BW-generated SAP HANA Calculation Views (column views in _SYS_BIC). Synonyms are created in your project in the SAP Web IDE for SAP HANA. Without a synonym you cannot refer to a specific object when developing a XSA Calculation View. For example, instead of referring to a table or another Calculation View, you simply refer to a synonym which points to the object you need. Think of a synonym as a shortcut to the required object.

Even though you are able to develop HDI / XSA Calculation Views that consume BW-generated views (classic XS), you will not be able to query the view because your XSA user does not have permission and also the generated Analytic Privileges for the view are not assigned to the XSA user. This must be done manually.

There is role generator provided by SAP (ZRS2HANA_CREATE_XSA_ROLES), that collects all the BW-generated view roles that contains the generated analytic privileges, and also grants the required SELECT permission for all BW-generated views.

You work through the four steps listed in the interface of the program. However you should be aware that there is still one manual step that must be completed. That is to adjust the .hdbgrants file in your HANA project so that it includes the name of the global role that you generated using the program. Then, when you build your HDB module, the access permission is automatically granted to the XSA user of your container so that you are able to preview the data from Web IDE. You would also need to provide the role to each XSA application end user.

Launch the next demo to explore the use of an generated SAP HANA view in a mixed modeling scenario:

Using a Generated SAP HANA Calculation in a Mixed Modeling Scenario

Log in to track your progress & complete quizzes