Skip to Content
-1
Sep 17, 2018 at 05:36 AM

ABAP CDS Associations with parameters

17214 Views Last edit Sep 17, 2018 at 03:12 PM 3 rev

Hi All,

I have an CDS view with parameters defined as follows

@AbapCatalog.sqlViewName: 'zcds_sql'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Test'
define view ZCDS_VIEW1 with parameters
  p_vbeln: vbeln
  as select from vbak 
  {
   vbeln,
   erdat
   } where vbeln = $parameters.p_vbeln;
  

now i am trying to create association for above with sales order item table as follows

@AbapCatalog.sqlViewName: 'zdus_cds_ansql'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test'
define view Zdush_cds_annotation with parameters p_vbeln:vbeln
 as select from ZDUSH_CDS_VIEW1 
  
association [0..*] to vbap as __vbap
    on ZCDS_VIEW1.vbeln = __vbap.vbeln {
    vbeln,
    
    __vbap // Make association public
}

I get a syntax error saying 'ZDS_VIEW' requires parameter p_vbeln. How do you specify parameters in association is my question . I was not able to find syntax online for the same. Any help would be much appreciated.