Mentor SAP

 

The WITH PARAMETERS (  )… syntax in the CDS DDL allows for the definition of a CDS view with a comma-separated list of the scalar input parameter, as follows: -

  1. Each parameter is either typed with built-in ABAP types, such as abap.dec or abap.char, or with an ABAP Dictionary data element.
  2. The parameters can be used in the projection list of the CDS view, simply as elements or in expressions.
  3. The parameters can also be used in the JOIN condition of the FROM clause, in conditions in the WHERE and the HAVING clause.
  4. A parameter can be referenced using the syntax $parameter.<parameter name> or : <parameter name>

 

Input parameters can also be used in filter conditions in path expressions. This can make the definition of CDS view for re-use, with exposed associations, more valuable, especially when a parameter can be used in a filter expression to reduce a multi-valent association to a monovalent association.

 

Using input parameters in filters of path expressions is one way of using them in the addition of CDS views.

 

 

Using the annotation @Environment.systemField, you bind an input parameter to one of the ABAP system fields for the language with which the user is currently logged on, the user name, current date, time and client. This makes the input parameter optional for Open SQL queries and lets the value default to the system field value at runtime.

 

 

When defining a CDS view that uses a CDS view with input parameters, the parameters' values can also be passed in the FROM clause of the SELECT statement, as a comma-separated list of parameter name: Value pairs, enclosed in parentheses and following the name of the CDS view used.