Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member181964
Active Contributor
29,037
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...

GUI

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.

STEP: 1

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.

STEP: 2

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.




STEP: 3

Check the Semantics and see all fields.

STEP: 4

Save & Activate Calculation View.

STEP: 5

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.
4 Comments
Labels in this area