Skip to Content
1
Dec 07, 2022 at 04:26 AM

Using Window Expressions in BW ABAP Routines

349 Views Last edit Dec 07, 2022 at 04:31 AM 5 rev

Hello All,

I am looking to use window expressions in ABAP Routines in BW environment but getting following syntax error:

"OVER" is invalid here (due to grammar). contains an invalid character or it is a

As per this blog: https://blogs.sap.com/2021/11/24/window-expressions-in-abap-sql/ , we should be able to use window expressions in ABAP SQL (i.e. Open SQL in ABAP). However, I get the above stated error message when I attempt to use RANK( ) or others such window expressions such asSUM( ), COUNT( ), AVG( ), etc. SQL I am using within my test ABAP routine looks like:

     TYPES: BEGIN OF ls_windowfunctst,
		CITY TYPE c length 50, 
        RANK TYPE i,
        SALES TYPE p length 000009 decimals 000002,
      END OF ls_windowfunctst.
      DATA: lt_windowfunctst TYPE STANDARD TABLE OF ls_windowfunctst,
            wa_windowfunctst TYPE ls_windowfunctst.
      SELECT 
            CITY, 
            RANK( ) OVER( PARTITION BY CITY ORDER BY CITY ) as SALES_RANK,
            SALES
       FROM ZFMSALES
       INTO CORRESPONDING FIELDS OF TABLE @lt_windowfunctst.

We are running 7.5 SP8 for ABAP/BASIS ON HDB 2.0 on BW side.

If anyone has used window expressions with ABAP/Open SQL successfully, could you please advise what I might be doing wrong here? I suspect its not supported, but have not been to confirm this (hoping I am wrong since these expressions are pretty useful!).

TIA.