cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting Mulltiple records from ODATA Service

0 Kudos

Hi ,



I am not getting the  Multiple records  for a Gateway ODATA service.


For example:

http://123.XXXX/sap/opu/odata/sap/ZXXX_ORDARRY_SRV/ORDDETSet(Userid='XYZ',Type='11')?$format=json


The requirement : I need to get multiple orders data from  based on the User id 'XYZ'.


If I give the  URL as  '['http://123.XXXX/sap/opu/odata/sap/ZXXX_ORDARRY_SRV/ORDDETSet",
| http://123.XXXX/sap/opu/odata/sap/ZXXX_ORDARRY_SRV/ORDDETSet]

I will get the multiple orders.


 Entity set Mapping  is  referred to a Function module where the User ID is passed to Custom table and we are able to get the  Multiple values in the Tables Parameter.


But still the ODATA service returns the Single record.


Thanks,
Shreedhar

Accepted Solutions (1)

Accepted Solutions (1)

sreehari_vpillai
Active Contributor
0 Kudos

Hi Shree,

You understood the GEt_ENTITY operation in a wrong way. When you specify the key parameters, it will give you exactly one entity(record) identified by those key values . For example material number and language will be the keys to identify the description of a particular material in a language. Here in your case, first material you can not use to get multiple line items. You can use one of the below options.

Use an association : from you master (specified by USERID and TYPE) to the details .

Use filter to your entity set : Pass USERID and TYPE as filter parameter(ideally , in this case your entity structure will have more than 2 keys- may be a serial number as the third key )

Sree

0 Kudos

Thanks Sreehari. Shall I go ahead and create a Association to get the Multiple orders by passing the USERID as a Key . looks a good option.  is that what you mean?

sreehari_vpillai
Active Contributor
0 Kudos

Yes . let your base entity be the USER entity(as the association rule is , for a user, how many items (1:n)). Let the user entity be associated with the item entity with 1:n cardinality, so that when you execute the navigation , it will give you the list of item for the particular user.

sample URL structure : ..../Users('ABCDUSER')/Items

Sree

Answers (4)

Answers (4)

AshwinDutt
Active Contributor
0 Kudos

Refer this also, you will be able to get multiple table data as pasrt of GW response based on association and navigation.

http://scn.sap.com/community/gateway/blog/2014/09/24/lets-code-associationnavigation-and-data-provid...

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Sreedhar,

Refer below link..

Regards,

Vijay

AshwinDutt
Active Contributor
0 Kudos

Hello Shree,

You need to implement QUERY ( Get_EntitySet Method ) to get multilpe records on passing of filters.

Refer the below for info ->

http://scn.sap.com/community/developer-center/netweaver-gateway/blog/2013/12/22/steps-in-creating-ga...

http://scn.sap.com/community/gateway/blog/2014/03/06/let-s-code-crudq-and-function-import-operations...

Regards,

Ashwin

kedarT
Active Contributor
0 Kudos

Hi Shreedhar,

I hope you have userid and some other field marked as Key field in Entity Properties in SEGW.

Also do you see any error in Gateway Client.

0 Kudos

Kedar. I am not getting any Error message. Its a GET property. only thing it gives  a single record

kammaje_cis
Active Contributor
0 Kudos

Shreedhar,

When you provide key along with entityset name, it is called as READ. As per OData, read will always return one record.

If you need multiple records, what you need is Filter. You need to use $filter parameter and implement it as well.

I would suggest you to get familiar with OData concepts.

OData URL conventions may be first thing to start with.

URI Conventions | OData - The Protocol for REST APIs