CDS View with Parameters

Index

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:

CDSWithParameter

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.

Consumer_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!

Index

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s