Mentor SAP

 

To avoid runtime errors, it is necessary to query property VIEWS_WITH_PARAMETERS using method USE_FEATURES of class CL_ABAP_DBFEATURES.

 

The default value for Parameters in Open SQL

 

When you access a CDS view with parameters, you must provide actual values for all parameters. There is one exception from this rule: you can use annotation Environment.systemField to link an input parameter to a system field of the ABAP runtime environment.

 

When a CDS view is used as a data source in an Open SQL SELECT statement, any parameter annotated with Environment.systemField is considered optional. If no actual value is supplied, like in the example above, the system automatically supplies the parameter with the content of the related system field.

 

 

You can use annotation Environment.systemField strictly once per parameter. It is not supported to link the same parameter to more than one system field.

 

If a parameter is annotated with Environment.systemField, you can either make use of the default value from the system field or “override” that value with an explicit actual parameter.

 

For parameters annotated with Environment.systemField: #CLIENT, it is forbidden to specify an actual parameter explicitly. This rule has been introduced to avoid conflicts with Open SQL addition USE CLIENT.