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 Member

THIS DOCUMENT ONLY HIGHLIGHTS A SIMPLE METHOD OF USING INPUT PARAMETERS.

Create a simple SQLScript based Calculation View

1. In the Modeler perspective of SAP HANA STUDIO, expand the system node from the Navigator pane.

2. Expand the Content node.

3. Right-click the required package.

4. From the context menu, choose New > Calculation View.

    • Enter the name and description of the calculation view.
    • Select the required package.

Define Input Parameter

Right Click Input Parameter from the output pane --> New

Setup the input parameter as defined below screen shot

Name the INPUT PARAMETER as IYR which will later be used in the SQLScript

Create a Script-Based Calculation View

1. Choose SQL Script.

2. Select the required schema from the Default Schema drop-down list, for unqualified access in SQL.

3. Choose Finish.

4. Define the Output Structure

     a. Choose Define Output Parameter from the output pane.

     b. Add the output parameter(s) with the required data type and length.

     c. Choose OK.

In our case OUTPUT should be as below

5. Define the Function

     a. Define the function using SQL Script commands.

In our case the SQL Script command should be as below. IYR is input parameter which is used to filter data for a particular calendar year

/********* Begin Procedure Script ************/

BEGIN
var_out =  select SUM("SALES_AMT") AS SALES_AMT, SUM("SALES_UNIT") AS SALES_UNIT, CAL_YEAR AS YR FROM  TABLE_A, TABLE_B      

WHERE "TABLE_A"."CAL_SKEY"="TABLE_B"."CAL_SKEY" AND "TABLE_A"."CAL_YEAR" = IYR      

GROUP BY "TABLE_B"."CAL_YEAR";

END;
/********* End Procedure Script ************/

6. SAVE and ACTIVATE the Calculation View

7. Click on DATA PREVIEW in HANA STUDIO

8. Enter the valid INPUT VALUE in the Input window as denoted

9. The Output data wil be result of a query which will filter data for 2011 YEAR

20 Comments
Labels in this area