Skip to Content

ABAP CDS View with input parameters


A CDS is defined for existing database tables and any other views or CDS Views in ABAP Dictionary using the statement DEFINE VIEW in the DDL in ABAP Core Data Services(CDS) . This is done in CDS Source code in the ABAP Development tools(ADT). Every CDS view has its own CDS Source code.

Two objects are created in ABAP Dictionary of Every CDS View:

  • CDS Database View : It is read-only classical database view in ABAP Dictionary.
  • CDS Entity: It is actual CDS view. It covers the CDS Database view and makes other attributes possible, such as authorization checks defined in CDS view

A CDS View has two types of keys:

  • For CDS Entities ,KEY can be used to define key elements, This Key is the semantic key of the CDS View
  • The key of the CDS database view is determined implicitly, as in a classical view. This key is a technical key of the CDS View.

ABAP CDS- DEFINE VIEW parameter list


…..WITH PARAMETERS pname1:parameter type,pname2…

Effect: Defines Input parameters pname1,pname2 in a CDS View in ABAP CDS in a comma separated list. Each input parameter must be typed with a data type parameter type.



The following CDS View has a list of two input parameters in the WHERE Clause of the SELECT statement.


    Define view demo_parameters_cds

    With parameters p_country:LAND1_GP,


    as Select from KNA1

        { key kunnr,

                land1 as Country key,


                ort01 as City,

                region as Region

        } where land1 = : p_country and regio = : p_region;

Steps to be shown in this document:

  1. Define input parameters in a CDS View
  2. Use input parameters in a CDS View.
  3. Define a View as a parameterized view.
  4. Call a parameterized view with open SQL.

1.Define input parameters in a CDS View.

  • Start ABAP in Eclipse
  • Right click on the package icon,and from the context menu select New->other ABAP repository object.





2.Use input parameters in a CDS View.


@EnduserTextLabel :’ABAP CDS View with input parameters’

Define view ZCDS_DD1_IP_TEST

    With parameters matnr:abap.numc(18),


  As select from mara as a

        inner join  makt as b

        on a.matnr = b.matnr


        key a.matnr as material,

              b.maktx as description,

              $parameters.Lang as language

      } where a.matnr = $parameters.matnr and b.spras = $parameters.Lang;




3.Define a Parameterized view.

Shown the material description as per the language specified on input parameter.





4.Call a parameterized view with open SQL.


    With parameters  matnr:abap.numc(18),


     As select * from ZCDS_DD1_IP_TEST(matnr:$parameters.matnr,lang:$parameters.Lang)



Reference Links:

You must be Logged on to comment or reply to a post.