Saturday, 20 August 2016

HOW TO GENERATE ROW NUMBER OR SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Created a Table name Country in SAP HANA and have following columns:
COUNTRY_NAME        VARCHAR (50)
COUNTRY_ID                INTEGER

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Inserted values in Country Table and it has 5 countries

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Creating Calculation view in SAP HANA using graphical type

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Added Projection

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Added country table in projection

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Click ok, country table is added & select columns from Projection

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Click  On  RANK &  drop


HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

CONNECT COUNTRY PROJECTION TO RANK and double click on Rank
Select COUNTRY & COUNTRY_ID and screen will look like below

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Click on Rank and please do the following steps:

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Click on Threshold & set your threshold limit

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

ORDER BY :   SELECT COUNTRY_ID  in order By

NOTE:             YOU CAN DEFINE CALCULATED COLUMN AS AN INTEGER OR DOUBLE AND SET THE VALUE  1
                         AND YOU CAN ALSO USE THIS CALCULATED COLUMN INSTEAD OF USING TABLE COLUMN.
                         I AM USING COUNTRY_ID FROM TABLE TO DEMONSTRATE THAT WE CAN ACHIEVE ROW_NUM GENERATION OR SEQ_NUM GENERATION USING GRAPHICAL CALC VIEW.

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Partition By:    Add COUNTRY_ID  in  partition by Column

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Click on Generate Rank Column:  Add column title you need like ROW_NUM  etc.

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

CONNECT  RANK  projection to final projection:

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Click on Activate & Preview. I have clicked ROW_NUM to sort in Ascending

HOW TO GENERATE ROW NUMBER OR  SEQUENCE NUMBER USING HANA GRAPHICAL CALC VIEW RANK

Source: scn.sap.com