banner ads

ABAP CDS View With Input parameters | Parameters in CDS Views | CDS View with Parameters

CDS View with Input Parameters

In this ABAP for Hana blog, we are going to learn How to create ABAP CDS views with parameters in ABAP for HANA. Input parameters are used to restrict the data from CDS Views. Input Parameters in cds views used to take user input and filter out the data from the CDS view accordingly.

CDS View with Parameters

You define input parameters by placing addition WITH PARAMETERS after the CDS View name. The parameters are then defined in a comma-separated list. Each input parameter must be typed with an elementary data type. This can be a predefined ABAP Dictionary type (in the form abap.() ), or a data element. Structure types, table types or reference types are not allowed.

ABAP CDS view with Input Parameters

A CDS view is defined for existing database tables and views, or for other CDS views in ABAP Dictionary, using the ABAP CDS statement DEFINE VIEW. A CDS view serves to define the structure of an SQL view and represents a projection onto one or several Dictionary tables or Dictionary views.

Step to Create CDS View Parameters

1       1)    Right Click on your favourite packages and select new and click on other ABAP Repository object.

      2)    In the New ABAP Repository object window search for DDL source object select  the DDL Source and Click Next.

   3)    In the New DDL Source window  enter Name and Description of the CDS View and Click on enter.

      4) In Templates window select define view with parameters  and click on finish.

      5)    Cds View editor open with predefined code which you need to edit as per data source name and sql view name.

1    6)    Change the Sql View name as ‘ZV_TEST_PARM’ and data source name as Shown in the below screenshot.

1    7)    Add some fields from table and define input parameters in where condition.

1    8)    Then Click on check and Activate program to create CDS View.

1     9)    After activation of CDS View click on RUN and select ABAP application and click on Ok. 

      10)    In pop up window enter parameters value as shown in below picture.

       11) Output with extracted data.

     Good Job !!!!

Now you have learnt how to Create CDS View with input parameters.

Stay tune with us for more blog..

Thanks You 😇

No comments