cancel
Showing results for 
Search instead for 
Did you mean: 

Pass parameter into get_entityset

Former Member
0 Kudos

Hi,

I've successfully pass parameter into get_entityset using it_filter_select_options but is there a better way to pass parameter into get_entityset?

Normally a service like this http://abc.abc.com:8001/sap/opu/odata/sap/TIMESHEETSERV/Weeks('2012-04-23') would only call the get_entity.

What I had done is to utilize the it_filter_select_options - http://abc.abc.com:8001/sap/opu/odata/sap/TIMESHEETSERV/Weeks?$filter=keyDate eq '2012-04-12' to pass in the value into get_entityset. The reason is so I can use '2012-04-12' in get_entityset to get a collection of data.

Please feels free to suggest any other method that I might have overlooked.

Regards,

HK

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182048
Active Contributor
0 Kudos

Hi HK,

I think you are on the right track, to get a subset of values you would use a filter.

One thing to note however is dates and timestamps in ABAP should map to Edm.DateTime and the correct way to access them in a filter would be something like

/Weeks?$filter=keyDate eq datetime'2012-04-12T12:00:00'

for example

http://services.odata.org/Northwind/Northwind.svc/Customers('ALFKI')/Orders?$filter=ShippedDate gt d...

I have got the above Northwind example working in my Gateway system, see http://mysapgw.wordpress.com/2012/01/25/filter-string-how-to/, had to parse the datetime string manually, from memory used an xsd:datetime function, but you could just as easily write your own doing similar to what you did in previous question.

Hope it helps.

Cheers

JSP