Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SAP HANA Calculation View – SQL Script

In this blog, I’m going explain how to create SAP HANA Calculation View using SQL Code. i.e. SQL Scripted Calculation View.

In general we create Script-based calculation views to depict complex calculation scenarios by writing SQL script statements. It is a viable alternative to depict complex business scenarios, which you cannot achieve by creating other information views (Attribute, Analytical, and Graphical Calculation views).

Generally we can create Calculation Views in two ways like…


SQL Script

To explain one simple scenario, I tool MARA, MAKT, KNA1, VBAK and VBAP tables. Using all these tables, I will create a SQL Scripted Calculation View. It will not contain any additional calculation, it just displays OUTPUT without taking any INPUT parameters.

i.e. It contains only OUT parameter, and no IN parameter.

I selected few fields from above all tables and JOINED all above tables using Left Outer Join.


Create a Calculation View i.e. Type is SQL Script.

Under Columns, create all OUTPUT fields which are required to display in Output.

See the below screenshot, once I created all fields, it looks like below.

Note: We can create additional fields under columns, and we can calculate them using SQL Code.


Write SQL Code to get all above fields form different tables and display final OUTPUT.

In the below code, I just joined all tables using Left Outer Join, this is just to explain simple scenario.


Check the Semantics and see all fields.


Save & Activate Calculation View.


Display the data.

In upcoming blogs, I will explain the Procedures, Functions and also extend the Calculation View with Parameters and additional fields under Columns.

This post first appeared on Web Service Testing A Blackjack GUI And API, please read the originial post: here

Share the post

SAP HANA Calculation View – SQL Script


Subscribe to Web Service Testing A Blackjack Gui And Api

Get updates delivered right to your inbox!

Thank you for your subscription