Set the Entity Parameters for Core Data Services (CDS) and External Views

Prerequisites

The CDS view parameters can be used since SAP NetWeaver 7.40 SP08.

Context

Gateway services constructed on the basis of:
  • SAP HANA views with parameters or
  • CDS views with parameters
need to provide values for these parameters before selection. Parameters for all related views with parameters have to be provided in the same method call. See the following sections.

In a simple case, you ou can pass these parameters using the query options with the following steps:

Procedure

  1. Set the values for the parameters.
    DATA lt_parameters TYPE if_sadl_public_types=>tt_entity_parameters.
      APPEND VALUE #( entity_alias = 'SalesOrderHeaders' 
                      parameters = VALUE #( ( name = 'CURRENCY_CODE' value = 'EUR' ) 
                                            ( name = 'STATUS'        value = 'APPROVED' ) ) 
                   TO lt_parameters.
    
  2. Pass the parameter table to the service.
    io_query_options->set_entity_parameters( lt_parameters ).