cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch data based on input in OData service

Former Member
0 Kudos

Hi everyone,

I created BAPI to fetch sales details of a given customer.

Import parameter

   CUST_NO

Export Parameter

   RETURN

Tables:  SALES_TAB   (Table having 4 columns given below)

                *  SO_NO

                *  SO_DATE

                *  NET_VALUE

                *  CURRENCY

BAPI working fine.

Now I want to create a OData service by importing the above BAPI function.

I have little confusion while selecting the fields to create a model.

I want to take RETURN structure also.

Another question is do I need to go with GetEntity (Read) or GetEntitySet (Query) for my above BAPI.

Please help.

Ravinder.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190010
Contributor
0 Kudos

Hi Ravinder,

Please look at the following post that will clarify our idea on developing odata services:

Regarding your question about GetEntity and GetEntitySet your answer below:

'GetEntitySet (Query)' is to get a array of values i.e. if you need to get multiple records from a database table/tables


'GetEntity (Read)' is used to get one single record i.e. all the details of  a particular employee/customer.


Regards,

Emanuel

Former Member
0 Kudos

Hi Emanuel,

I saw the above examples. In that example, he is fetching all sales orders list without giving input.

In my case, Customer number is the input. Sales orders list is the output.

My main aim is to provide CUST_NO as an input in the OData URI.

Can you give me one example URI with customer number as an input.

Thank you.

former_member190010
Contributor
0 Kudos

Hi Ravinder,

If you want to add the possibility to filter to the odata web service, you have to add some code in the odata web service.

There is an excellent detailed blog on how to do this:

How to Develop Query Options for an OData Service Using Code-Based Implementation

Regards,

Emanuel

SB9
Active Participant
0 Kudos

You need to implement filter. Your odata call would look somwhat like -

http://<server>:<port>/.../SalesOrderSet?$filter=(CustomerNo eq '1000232')

To do this you would need to implement operation GetEntitySet. If you need to query by Sales Order Number, then it you would need to implement GetEnitity operation.

http://<server>:<port>/../SalesOrder('9000231')