CDS TUTORIAL 3: SAP HANA ABAP MADE EASY

Share

In this tutorial will cover how to call a CDS view having parameter from a report and Calling CDS view inside a CDS view

For CDS basics refer CDS tutorial 1 and for parameterized CDS refer CDS tutorial 2

  1. Create CDS View parameter

@AbapCatalog.sqlViewName: ‘ZCDS_EG22_SV22’

@AbapCatalog.compiler.compareFilter:true

@AbapCatalog.preserveKey: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: ‘CDS with param’

define view zcds_eg22

  with parameters

    p_vbeln : vbeln,

    p_audat : datum

  as select from vbak

{

  key vbeln,

      audat,

      augru

}

where

      vbeln = $parameters.p_vbeln

  and audat = $parameters.p_audat

  1. Create a SE38 report use cds view name as a source and inside the parathesis give the parameter value,if multiple parameters are there then it has to be , separated

     SELECT *

INTO TABLE @data(lt_data)

FROM zcds_eg22( 

              p_vbeln = ‘000000123’ , 

              p_audat = ‘20210810’

              ).

cl_demo_output=>display(

  EXPORTING

    data = lt_data

*    name =

).

  1. Calling a CDS view inside a CDS View source name will be CDS view name along with source CDS view parameter check below eg.