The driver supports CDS views and CDS views that require parameters. The driver exposes CDS views as tables in a schema, as it does with other SAP services that use the ODATA V2 API. How a CDS view is queried depends on whether the CDS view requires parameters.

CDS views that do not require parameters

If querying a CDS view that does not require parameters, two-part notation should be used to specify the CDS view. In the following example, YY1_CDSVIEW_SCHEMA is the name of the schema and CDSVIEW_ENTITY is the entity or table name of the CDS view.

SELECT * FROM YY1_CDSVIEW_SCHEMA.CDSVIEW_ENTITY

In the following SQL statement, a WHERE clause is used to fetch records for the given region.

SELECT * FROM YY1_CDSVIEW_SCHEMA.CDSVIEW_ENTITY WHERE REGION = 'Northwest'

CDS views that require parameters

For a CDS view that requires a parameter, the required parameter must be specified in a WHERE clause and the values of the parameter must be specified in an equality expression. For example:

SELECT * FROM YY1_CDSVIEW_SCHEMA.CDSVIEW_ENTITY WHERE P_KEYDATE = {d '2017-03-28'}

You can determine which tables require WHERE clause filtering by querying the system table SYSTEM_COLUMNS_REQUIRED_FILTERS that resides in the driver's internal schema INFORMATION_SCHEMA. The following example searches the schema YY1_CDSVIEW_SCHEMA for this information.

SELECT * FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS_REQUIRED_FILTERS WHERE TABLE_SCHEM = 'YY1_CDSVIEW_SCHEMA'

Note:

  • Some CDS views may require more than one parameter. In these instances, each required parameter must be included in the WHERE clause using an AND operator to separate the expressions.
  • Some CDS views may have optional parameters. When an optional parameter is included in the WHERE clause, the driver includes the optional parameter in the request.
  • Currently, the OR operator is not supported for separating parameter values.