Greetings to all in the SAP Community. My name is Quincy Anderson and I’m a Senior Education Consultant for SAP America. I teach classes in various areas such as ABAP, JAVA, Process Integration, Workflow, Master Data Governance and the subject of this blog, SAP HANA.
With the release of Service Pack Stack 11 (SPS11) of the SAP HANA platform there have been a number of changes that have in turn necessitated an update of the best practices you should be aware of and follow. One change is the deprecation (in most use cases) of two traditional types of Information models (Attribute, and Analytic Views) in favor of the use of a third (Calculation View). That is the subject of this blog. Another change (which will be covered in a subsequent blog) is the deprecation of a script-based Calculation View in favor of a new type of artifact (Table Function).
The database features of the SAP HANA platform, while certainly important, are not the only features of the platform. It also provides an environment to develop a multitude of artifacts beyond just simple database objects (for example, tables, views, etc.). A developer using the SAP HANA studio can create information models that are then used as data sources for consumption by various front end tools (SAP Lumira, SAP Predictive Analysis, SAP Crystal Reports) or by exposing the information models as OData Services consumed by custom-built SAP Fiori Applications. Take a quick look at the following sample Calculation View:
This Calculation View is designed as the union of two projections (Tables CEA1_00 and CEP1_00). Aggregations (specifically sums) are then done on the numeric fields (seven in this example) and the result is information that can be consumed by a client for analytic purposes, as shown in the following screen.
Traditionally there have been three types of information models that we teach developers to create in our training courses. They are Attribute Views, Analytic Views, and Calculation Views. With the advent of SPS11, Attribute Views and Analytic Views are incorporated within Calculation Views. This of course requires a little bit of a “deep dive” to explain.
Let’s do Attribute Views first. An Attribute View exists to provide insight on parts of your organization. This allows you to do a more sophisticated analysis of your numbers (sales orders by last name for example). Take a look at the sample Attribute View below dealing with Business Partners:
Using a series of joins, we can get detailed information about our Business Partners (for example, name, language, e-mail address). Take a look at the result:
Starting with SAP HANA SPS11, instead of Attribute Views developers are instead to create Calculation Views of type “DIMENSION”. This setting is done in “View Properties” (see below):
The result is the same but the artifact created to get that result is different.
Now let’s look at Analytic Views. An Analytic takes a data source with “numbers” (sales numbers, cost numbers, revenue numbers, etc.) and “joins” those numbers with “dimensions” (like our previous Business Partner sample) to provide meaningful insight to those numbers to be used for analysis and decision making. Take a look at this sample Analytic View:
At first the screen may appear “busy” but actually what we’re looking at is pretty straightforward. The data foundation contains the “numbers” (gross_amount and net_amount in this case). The three data sources surrounding the foundation node contain the “dimensions” (Products and Business Partners). The dimensions give the numbers more meaning. Observe:
Being able to analyze gross sales and net sales by name or product ID or product category is a lot more useful to a decision maker.
As mentioned previously in our Analytic View, the data foundation is surrounded by dimensions (of which there can be any number of; three in our case). In our solar system our sun is surrounded by eight planets. Based on this analogy, an Analytic View is designed based on the concept of the “Star Join.” The data foundation source is the “sun.” The dimension sources are the “planets.”
Starting with SAP HANA SPS11, instead of Analytic Views developers are instead to create Calculation Views of type “CUBE With Star Join.” This setting is done when the view is created, as shown in the following:
When looking at the previous figure, the key is to remember when creating the Calculation View to set the data category to “CUBE” and to select the checkbox labeled “With Star Join.” Afterwards you design the same functionality albeit in a different artifact, as shown in the following screen:
To wrap up our blog, here are just a few other tidbits:
SAP HANA studio SPS11 provides a migration tool to migrate Attribute and Analytic Views to Calculation Views of the appropriate type. However, you are not required to migrate existing views and can use Calculation Views going forward.
There are three situations where Calculation Views cannot be used because the specific functionality desired is not supported. These are (a) Fuzzy Search Support, (b) Derived Views and (c) Temporal Join Support. The first two are supported by Attribute Views and the last is supported by Analytic Views. Instead of using this functionality, you are advised to continue to use Attribute and Analytic Views as appropriate.
Check out our training on SAP HANA modeling: HA300