on 06-30-2014 6:41 PM
Hi all,
I am new to OData Services in HANA. I want to build OData service for search capability.
Problem :
1. I want to pass search_criteria and some of the filters from my web application to OData Service (Basically REST url).
2. Based on parameters I get from web application to OData Service I want to use these parameters in my service.
3. Plan is from OData service I may call Stored Procedure or View and pass search criteria and filters details to Stored Procedure or View and get the appropriate result which would be the response of my service (most probably JSON response)
Can someone provide some idea how to go about this.
Your help will be greatly appreciated.
Thank you.
Dharmesh
Have you read up on XSODATA? It is a development object built into HANA for building OData services and it has all the functionality you described. You don't have to code the service itself. You create an XSODATA specification file which describes which table(s)/view(s) you want to use as the source of the service. I would suggest reading more about XSODATA in the HANA Developers' Guide, HANA Academy, or openSAP and see if it meets your needs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
First of all thank you for your reply. I am also taking training that you have on openSAP but haven't completed yet.
Yes, I have created sample OData service using XSODATA and I am referring your videos to do that.
I am also going through Developers Guide but not getting clear idea how can I pass query parameters through URL and how can I consume that in the searchService.xsodata file. Once I am able to do that I also want to pass that parameters to stored procedure so that base on the search criteria I can get result back.
I would really appreciate if you can guide me what kind of mechanism I should use to achieve this and if you have example to refer that would really great.
Regards,
Dharmesh
Filter and sorting is built into the OData framework and can be supplied automatically to any field exposed in the service. For example you have a service with the Column Currency in it. You want to filter and receive records with only Euros. You would add this to the request URL:
$filter=((Currency%20eq%20%27EUR%27))
There is nothing you need to do on the server side to process this. The filter is handled by the XSODATA framework.
Hi Dharmesh,
1. You can not pass JSON objects as filter string in OData . But you can achieve the same in XSJS. Read the below blog.
2. Stored Procedures can be consumed if you consume the same in a scripted calculation view
Sreehari
Hi Thomas , Sreehari,
Thank you for your all answers and I found these are really helpful. I learn a lot from these posts.
While going through all this I found something call $search system query option for doing in full-text search which was introduced as part of OData-4.
As far as I know HANA support OData-2 with SP8. Is there a way I can use $search option for my OData Service?
Regards,
- Dharmesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.