CDS views now come with the request Parameterization where scalar parameters can be passed to a CDS view.
CDS with Parameter is very similar to normal CDS with the addition of keyword WITH PARAMETERS followed by the parameter name and its type.
Till ABAP version 7.51, structured or tabular parameters are not allowed.
Let’s take a simple example to understand this:
Here, CDS view ZCDS_PARAM has single parameter PART_NUMBER with type MATNR. This input parameter is used in WHERE condition with “:” operator. Instead of “:” operator, “$PARAMETERS” can also be used (line 16).
Consuming CDS view is very easy and it can be achieved by passing parameters with SELECT. A CDS can be consumed by e.g. other CDS or an ABAP program.
Above, a simple ABAP SELECT is consuming CDS – ZCDS_PARAM by passing parameter PART_NUMBER!
Feel free to Clone the Code from GitHub and test by yourself!