cancel
Showing results for 
Search instead for 
Did you mean: 

Input Parameters for Odata Service

former_member192971
Participant
0 Kudos

Hello Experts ,

    I would like to generate an Odata Service based on Remote Enabled Function Module . But the Issue here is where we need to Provide/Mark the fields as Input and Output Parameters . And Do we have to write Anycode in the Get_entity_set method .Even I tried with the Mapping to Data source for the fields as Input and Output Parameters.But coming to service , I'm not able to get the output.

Can Anyone help me in getting this solved .Also please share any documents related to Odata .

Appreciate your help.

Thanks,

Uday.

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos
former_member192971
Participant
0 Kudos

Hi Andre ,

    Thanks for your prompt response. And I have one more doubt regarding how to pass multiple Input Parameters for the Odata service URL at the time of execution .

avishek_gorai2
Participant
0 Kudos

Hi Uday,

For multiple input parameters use the following URL pattern:

$filter=Filter1 eq 'value1'&$filter=Filter2 eq 'value2'

Where Filter1 and Filter2 are the actual field names of the parameters.

Regards,

Avishek.

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Avishek,

this expression is not correct.

The expression

BusinessPartnerCollection?$filter=CompanyName ge 'S' and CompanyName le 'T'& $filter=CompanyName ge 'M' and CompanyName le 'L'&$select=CompanyName

would only retrieve BusinessPartners whose name start with an S or T, that means only that filterstring is used that is passed with the first occurence of $fitler. The second filter string is omitted.

But it will retrieve only the property "CompanyName".

The correct expression for the $fitler would be

$filter=((CompanyName ge 'S' and CompanyName le 'T' ) or (CompanyName ge 'M' and CompanyName le 'L'))&$select=CompanyName

Best Regards,

Andre

avishek_gorai2
Participant
0 Kudos

You are right Andre, thanks for pointing out.

Regards,

Avishek.

lakshmi_narayana2
Active Participant
0 Kudos

Hi

We have a similar scenario with little difference. We have a RFC developed on top of a BW query which takes 3 input parameters and returns a structure. We have created the service and the entities and entity sets without any errors. But when we execute the service we do not see any data.

Followed the step to step guide mentioned in one of the above replies.

We tried to send the parameters as suggested above and we do not see any data still.

Not sure what is missing. Appreciate any help

Thanks in advance

Lakshmi

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Lakshmi,

if your query is marked as an Easy Query there is also the option to generate an OData service using redefinition option.

For this you have to right click on your data model in SEGW and choose:

Redefine --> BW Query Service.

Here you have the option to use either Easy Queries or MDX queries.

Best Regards,

Andre

former_member206574
Active Participant
0 Kudos

Hi Narayana,

We have a RFC developed on top of a BW query which takes 3 input parameters and returns a structure. We have created the service and the entities and entity sets without any errors.


In return parameter are you getting a actual data which needs to show response in odata or r just returning the output structure.


Please provide the screen shot of your RFC to understand how exactly your RFC works.



Regards,

Venu

Answers (1)

Answers (1)

Rekha_DR
Developer Advocate
Developer Advocate
0 Kudos

Hello All,

How to frame the URI to get multiple records from the same entity set ?

example : I would like to retrieve NotificationNumber 'A' and NotificationNumber 'Y'

from 'NotificationHeaderSet'. I do not want to use 'ge' and 'le'. But would like to filter random 2 records.

Regards,

Rekha

EkanshCapgemini
Active Contributor
0 Kudos

Hi Rekha,

The expression would be : /sap/opu/.../NotificationHeaderSet?$filter=NotificationNumber eq 'A' and NotificationNumber eq 'B'

You need to be aware that in gateway framework you will get these values as range, now the business logic(can be direct select query or RFC) to get the notification header should be capable enough to take this range and give you only those value. For details, you can check this doc

Regards,

Ekansh

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ekansh,

the expresssion is not correct. You have to use 'OR' instead of 'AND'.

When using 'AND' the resultset will be empty.

While using the statement

/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet?$filter=(SupplierID eq '0100000015' or SupplierID eq '0100000010'  )

you will get 6 products the statement

/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet?$filter=(SupplierID eq '0100000015' and SupplierID eq '0100000010'  )


does not contain any product.

Best Regards,

Andre

Rekha_DR
Developer Advocate
Developer Advocate
0 Kudos

Hello Ekansh and Andre ,

Thanks for your answers . AND didnt work for me but OR did . Thank you Andre .

Regards,

Rekha

EkanshCapgemini
Active Contributor
0 Kudos

Yeah Andre, my mistake. Thanks for correction.

Former Member
0 Kudos

Hi Andre

It reminds me the AND-OR situation we met. We've done a simple request to KNA1 table via NW service.

The request

/sap/opu/odata/......SRV/ClientSet?$filter=Kunnr eq '0000000006' AND Name1 eq 'Test'
worked OK and gave 1 record.

But the request

/sap/opu/odata/......SRV/ClientSet?$filter=Kunnr eq '0000000006' OR Name1 eq 'Test'
gave an error, because io_tech_request_context->get_filter( )->get_filter_select_options( ) (for shorter) doesn't transform the request to select_option table.

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Andrei,

you can try to retrieve an osql statement:

DATA: lv_osql_where_clause TYPE string.

lv_osql_where_clause = io_tech_request_context->get_osql_where_clause_convert( ).


When using the following statement

/sap/opu/odata/SAP/ZNAVPROP_SRV/CarrierSet?$filter=Carrid eq 'AA' or Carrname eq 'Air Berlin'

in the Gateway Client I get the following value for lv_osql_where_clause

( ( CARRID = 'AA' ) OR ( CARRNAME = 'Air Berlin' ) )

Best Regards,

Andre

Former Member
0 Kudos

Thanks for reply, Andre

We've made it easily via io_tech_request_context->get_filter( )->get_filter_string( ) and then dynamic SQL. The only problem is that development takes more time in this case - some additional checks should be done. It leaves a feeling that SAP does not completely cover oData standard. For any code automatically generated by SAP for Search Helps or Fms it is definitely a problem.