SAP has provided with GW SP04 a basic integration framework for creating an OData service based on the HANA DB. With this framework you can easily expose the HANA analytical models via the REST based Open Data (OData) format.
I was very enthusiastic to try this one out and I was able to create such a service in very less time. And you don’t have to be an ABAP expert to build such a service.
I have outlined the steps to create such a service referring to the help document at
http://help.sap.com/saphelp_gateway20sp04/helpdata/en/33/0e14f0590b48318ea38b3a06a92d17/content.htm and some from trial and error.
There are also some limitations currently on the integration which are also documented above. I will create a simple service on an attribute view which will fetch the data in the service.
- The First step you need logon to the HANA Client and create a View (Attribute/Analytic/Calculation). Make a note of the catalogue name and the view name.
- Check your SAP Netweaver Gateway system or the Backend system wherever you are trying to create the service has the add-on component Installed.
- Now logon to the Backend SAP Netweaver Gateway system and maintain an ADBC Connection via the table DBCON. Provide the details in the table. Make sure you enter the Connection limit and Optimum Conns as >1 this is because the Data Provider class creates more than one connections to the database. Hence if it is 1 the Connection will fail.
- The next step is you need to implement the enhancement spot /IWBEP/ES_DESTIN_FINDER. This is to declare the maintained SAP HANA connection to the framework. Give the Enhancement Implementation name and description and then BADI definition name Description and the implementation class name. In the Filter Values give Now redefine the methods /IWBEP/IF_DESTIN_FINDER_BADI~GET_DB_CONNECTION and export the DBCON Connection name. /IWBE/IF_DESTIN_FINDER_BADI~GET_RFC_DESTINATION here export the system alias of the system where the service is created.
- In the next step you need to create the model provider class with super class as /IWHDB/CL_HAI_RT_ABS_MODEL and redefine the class method GET_HDB_ARTIFACTS and pass the catalog name and view name you got is step 1. (Here you can also specify multiple views for a single service which will come as different entity sets , By default the entity set name will be the view name if you want a different name you can specify a name in lr_view->entity_set_name )
- Next step is to create a model and assign the Model Provide class.
Goto transaction /n/iwbep/reg_model and enter a model name and version and press create. And in the next screen enter the MPC and description and save.
- Next create a service via transaction /n/iwbep/reg_service. Enter the service name and version and click on create. In the next screen enter the Data Provider class as /IWHDB/CL_HAI_RT_DATA and a description and save.
Next assign the model previously created with Assign model button enter the details of model and save.
- Next is to test the service. If you have created the service in the Backend system then you have to login to the SAP Netweaver gateway system to add/test the service.
- Goto Transaction /IWFND/MAINT_SERVICE and click on add service. In the Next screen specify the system alias and check for your service and activate the service.
- Now go back to the previous screen and add system aliases to the service you activated. Check that the ICF node for ODATA is active.
- Click on Explore service to test the service. Check for Service Document, Metadata and Entity sets.