Saturday, December 5, 2020

CDS View with Multiple Parameters

 CDS View with Multiple Parameter :

Sample code to show CDS View with Multiple Parameters.

In this Case : We have taken 2 parameters : 

1 P_CARRID 

2.P_CONNID 

and using the same to fetch data.

@AbapCatalog.sqlViewName: 'ZSD_SQL_PARM'
@AbapCatalog.compiler.CompareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS WITH PARAMETERS'
define view ZSD_CDS_PARAMETER
    with parameters
    P_CARRID  : S_CARR_ID,
    P_CONNID  : S_CONN_ID
as select from spfli {
    
    key carrid,
    key connid,
    countryfr,
    cityfrom,
    cityto
}
where  carrid = $parameters.P_CARRID and connid = $parameters.P_CONNID;