cancel
Showing results for 
Search instead for 
Did you mean: 

Odata Service for CDS View with Input Parameter

Former Member
0 Kudos

Hi Gurus,

I would needing yours expert suggestion for following problem:

1. I've created on CDS View with Input Parameter;

2. Then I created the Service in SEGW t-code

3. Now when I try to execute the Odata Service for this I'm getting below error:

Will be needing your expert views on this, I think I'm not correctly passing the Input parameter for the underlying CDS view, pleasw let me know how to do it.

Thanks and Regards,

Binay Biswakarma

Accepted Solutions (0)

Answers (2)

Answers (2)

vishnucta
Active Participant
0 Kudos

Hi Binay,

Append the query string $metadata and check the entity set name.After getting the entity set name use it and pass the required key field in the CDS view and the parameter that u have defined.

For eg:

And call the URl either from the gateway client or from the browser as below screen.

You can figure out the entity set name from the metadata information.

Regards,

Vishnu.

Former Member
0 Kudos

Hello Binay.

You can fill the input parameter in method IF_SADL_GW_QUERY_CONTROL~SET_QUERY_OPTIONS of your *_mpc_ext class.

Here is example of coding:

DATA lt_parameters TYPE if_sadl_public_types=>tt_entity_parameters.

   APPEND VALUE #( entity_alias = iv_entity_set

      parameters = VALUE #( ( name = 'P_LANGU' value = sy-langu )

                             ( name = 'P_MANDT' value = sy-mandt )

                                ) )

              TO lt_parameters.

   io_query_options->set_entity_parameters( lt_parameters ).

So, in the code above, I fill two input parameters of a CDS view: p_langu and p_mandt.

Best regards,

Viktor.