cancel
Showing results for 
Search instead for 
Did you mean: 

How to achieve Rank functionality in SAP DWC in Graphical model ?

avinash_eppar
Participant
0 Kudos
1,452

I searched for achieving the rank functionality in SAP DWC in Graphical model but seems there is no rank node available just like we have in HANA. I tried scripted view where I could not get proper syntax to implement the Rank functionality .

note : I did change the language to SQL Script ( Table Function)

Accepted Solutions (0)

Answers (3)

Answers (3)

reyemsaibot
Active Participant

Hi,

can't you use the rank sql function? Have a look here https://www.sqlshack.com/overview-of-sql-rank-functions/

best regards,

tobias

Sven_Knöpfler
Active Participant
0 Kudos

Just as an information: you can also create and consume calculation views from the HANA database that comes with your DWC tenant, its just a bit of hassle to put everything up:

Exchanging Data with SAP SQL Data Warehousing HDI Containers | SAP Help Portal

former_member563260
Participant
0 Kudos
// Sample code - Picks latest Sales Order for a Material
// ROWNUMBER can be replaced with RANK or DENSE_RANK based on requirement.

RETURN
SELECT
"MATNR",
"ERDAT",
"VBELN",
"ROWNUMBER"
FROM
(
SELECT
V_VBAK."VBELN" AS VBELN,
V_VBAK."ERDAT" AS ERDAT,
V_VBAP."MATNR" AS MATNR,
ROW_NUMBER() OVER (
PARTITION BY V_VBAP."MATNR"
ORDER BY
V_VBAK."ERDAT" DESC
) AS ROWNUMBER
FROM
"V_VBAK"
INNER JOIN "V_VBAP" ON V_VBAK."VBELN" = V_VBAP."VBELN"
)
WHERE
ROWNUMBER = 1;