AMDP Functions
AMDP Functions
OVER ( ) – function is used to specify which column to be considered while generating a row no. for the
row of the result set.
DISTNCT VALUES. The following example generates a distinct material number. The KOTN203 table has
a bonus number and material cardinality [1:N].
A USEFUL TRICK: When our data duplicates, we can eliminate the duplicating data by writing return
row_number = ‘1’ and showcasing the every unique row. For example let’s assume that we want to showcase the
every unique bonus buy row.
**Distinct
et_data = select bbynr, matnr from
(select ROW_NUMBER( ) over( partition by "BBYNR" ) AS RN1, * from kotn203 )
where RN1 = 1 and mandt = session_context( 'CLIENT' );
RANK( )- The RANK function returns duplicate values in the ranking sequence when there are ties between
values and the next rankings are skipped.
et_sort_data = select bbynr, matnr , werks , vkorg , vtweg ,
ROW_NUMBER( ) over( partition by "BBYNR" ORDER BY MATNR ASC ) AS ROW_ID,
RANK( ) over( partition by "BBYNR" ORDER BY MATNR ASC ) AS RANK_ID,
from kotn203 where mandt = session_context( 'CLIENT' );
DENSE_RANK( )- The DENSE_RANK function performs the same ranking operation as the RANK function,
except that rank numbering does not skip when ties are found.