Graphical Calculation View: Part 1

Understanding a Graphical Calculation View in SAP HANA

Hi everyone and welcome to the most important tutorial in this series where we learn how to create a graphical calculation view. Calculation views form the primary core reporting data model which is developed in SAP HANA. Some of you who have already done some kind of reading or training on SAP HANA might be wondering why I haven’t taught attribute views or analytical views yet before coming to this yet as other tutorials available online do. The answer is quite simple – creating them is no longer part of the HANA development best practices. There are still reasons to know them as some projects might have them from the older versions. But I will cover them after I finish the important stuff. Any development object that exists but is no longer recommended to be used will be covered in some legacy tutorials later on. For now, let’s focus on the important stuff.

Graphical Calculation View – What is it?

As mentioned earlier, this is the SAP recommended data model and it should cover most of your development needs. It offers most functionalities that you might need to create a meaningful data model for your reports to consume but in the rarer cases where the requirements are beyond its capabilities, you can switch to SQL based solution of Table functions (a newer version of Scripted Calculation Views) but those are separate tutorials covered in the SQL Script section.

The beauty of a graphical calculation view lies in the fact that it offers powerful calculations which can be used by a developer with no coding experience whatsoever and hence, learning curve is quite gentle.

Let’s learn with an example

There are lots of things you can do with a graphical calculation view and so I decided to split this tutorial into parts. This part creates a simple graphical calculation view by joining two tables. If you are new to the concept of a database JOIN, click here to read our tutorial on it

Let’s take a real business scenario using sales document data as an example. Sales documents have two parts – A header and an item. If you are new to this concept, you can visualize this in the form of any bill that you have received till date. Such a bill has a header/top part that always remains constant providing probably the company name, address and some more header level information. Thereafter, there is an Item section which contains individual items that you have ordered. In SAP, header and item details are often stored in separate header tables and item tables. Our example will utilize the sales document header table – VBAK and the sales document item table VBAP. These are two of the most commonly used tables for analysis in actual projects.

As mentioned, these are standard SAP tables and will be part of SAP ECC installations. From our data provisioning tutorial, you already know that the most popular way of provisioning data from SAP source systems is via SLT replication which would provide these tables to a schema under your catalog folder. Generally this task to replicate tables is not part of a developer’s task for many reasons like data security and due to the fact that it is a sensitive process. Developers would request the table they need for a data model and it would be then provided by the project system administrators responsible for the SLT replications.

In our example, ECC_DATA is the schema marked by the arrow below that houses all our SAP ECC tables. In your project, it might be something else. Check with your project administrator to find the correct schema. You can choose to use any table from any other schema to practice this if you don’t have an ECC connected.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

To create a new graphical calculation view, right click on your package and select New-> Calculation view from the context menu as shown.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

The below window pops up asking for a technical name and a label. The Name is important and should be a meaningful technical name as per your project naming convention whereas the label is just a description. The name gets copied to the label automatically but you can change it to whatever you find to be correct. The “Type” drop-down remains on Graphical by default and can be changed to “Scripted” in which case you have to code the entire view in SQL Script.  The data category is CUBE by default and should be selected when your data is expected to have measures which means that your data model is built to analyze transaction data. If there is no measure involved, select DIMENSION as the data category in which case you tell SAP HANA that the data model will be purely based on master data. If you do not understand the difference between master and transaction data, click here to revisit that tutorial.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

We name our graphical calculation view SALES_VIEW and keep the other settings as they are as they suit our requirement.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

So our requirement is to take two tables, VBAK and VBAP from the schema ECC_DATA and join them to create a graphical calculation view. The below screen opens up which is a easy drag and drop interface to build these graphical calculation views. Firstly, we need some placeholder to hold these tables. Such placeholder are called “Projections”. Drag and drop two of these into the screen as shown here.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

These empty projections will look as shown below.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

If you click on them and hover your mouse over them, you would get a green plus symbol as shown below. This helps you add objects to this Projection. A projection can be a placeholder for tables and other views as well.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

1

On clicking the green plus symbol, you will get a window where you can find the table you will add to this Projection. On the search area, write the name of your table which in our case is VBAK. As seen below, the system provides the list of all database objects which have VBAK in their name. We are looking for the table VBAK under ECC_DATA schema which will be represented by VBAK (ECC_DATA) as shown below. When you find the table you are looking for, select it and press OK.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

As seen below, the projection is no longer empty and houses the table VBAK . Click on the projection to open up the Details pane on the right side. Here you will see all fields associated with this table. In front of each field is a grey circle which allows you to select it for output from this projection node. This means that if you require the field VBELN, from this projection, you will need to click on that grey circle and it becomes orange which means that it is now selected. Now, select a few fields from this table. Note that if you are using a table from an SAP source, always select the field MANDT if it is available. The field MANDT indicates that the table is cross client. I have explained what “client” means in terms of SAP tables in a tutorial for a different section. You can check it out here.SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

As explained above, the fields I selected have an orange circle in front of them. That’s all we need to do here in projection 1. There are other options on the right most side of the screen like Filters and more but we will come to those in the following parts of this tutorial.

SAP HANA GRAPHICAL CALCULATION VIEW GRAPHICAL CALCULATION VIEWS

 

This tutorial continues in next page describing  JOIN nodes in graphical calculation view.

 

<<Previous Tutorial                                                                                                              Next Page>>

 

 

                                                                                                             

Tagged , , , , , , , , , , , , , .

80 Comments

  1. Hello Shyamuthaman, nice post n i have referred this links to my colleague also. I was wondering whether you are planning to write about some other topics like – currency conversion, CE functions ?

    • I will try to write an article on currency conversions soon.
      CE functions are obsolete.
      Always use HANA SQL only and never use CE functions.

  2. Hello Shyamunathan,

    Many thanks for the awesome stuff on HANA.

    I have a question when you say ‘creating attribute and analytical is no longer part of the HANA development best practices.’– what is the reason behind those being deprecated?

    Is it purely for simplicity of development and maintenance or it has any performance impacts as well?

    Thanks,
    Anubhav

    • Hi Anubhav,
      Simplicity has been HANA’s motto right from the start and as it progressed, it evolved to simplify even further.
      Calculation views were optimized and started to perform as well as the other views.
      ALso, Calc views had no restrictions on the number of fact tables like analytical views and could be modeled as a dimension calc view ..which the attribute view was earlier used for.

      Shyam

  3. Hi sir,

    Could you please let me know there is two engines in CV but when will go for which engine and what is difference between those two engines

  4. 1. I have created Calculation view in HANA studio, for which the values which are declared as measure are rounded off and even i am not able to see decimal places for the same.

    2. when i compare this values with SE16n in ECC i am finding this mismatch

    3. In ECC , total stock e.g 12,705.668 are appearing in HANA as Zero .and rest values are rounded off.

    How can we replicate the same values in HANA.

    Kindly suggest any settings i have to do for the same.

    Awaiting your response

    • If you have created no filters and transformations in SLT, there should not be discrepancies.
      It’s difficult to analyze the problem without looking at it.
      You can send the screenshots of each node in your calc view to me at shyam.uthaman@teachmehana.com and I can look at it.
      Make sure your table in HANA has the correct info first. Alternatively, reach out to someone who can come look at it on your system.. it would resolve things faster.

      • Hi shyam
        Thank you for your reply
        i have mailed u detailed description of my query
        Kindly go through the same.

  5. Hello Shyam,

    Thanks for the tutorials , it had helped me to learn native HANA swiftly and also iam able to work on native hana projects easily and your tutorials has been a reference point too.

    Keep your good work going 🙂

  6. Hi shyam
    Very gud information.
    I have a doubt what are the limitations of graphical calculation view. At which situation we have to go for sripted views.

    Thanks

  7. Hi shyamuthaman,

    Your SAP HANA tutorial is simply worth reading learnt alot.
    It would again really be a great help if you have SAP BW on HANA tutorial as well.
    Need to learn on urgent basis.
    Keep rocking..!
    keep teaching..!

    Thanks

  8. I created a calaculation view to create sales report and a input parameter to accept the year. I want to show total sale for each product based on the year. And I want to display sale difference between the selected year and previous year.

    Is it possible in graphical way?

  9. Hey Shyam,

    Your blog is a lifesaver and has been extremely helpful for me. Thanks a lot for all this effort!

    One small thing – “The field MANDT indicates that the table is cross client.” – Did you mean to say that it indicates that the table is client dependent? Cross client tables don’t have MANDT I believe.

Leave a Reply

Your email address will not be published. Required fields are marked *