Saturday, 7 May 2016

Creating HANA DB based SAP Netweaver Gateway Service

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.

1. 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.
2. Check your SAP Netweaver Gateway system or the Backend system wherever you are trying to create the service has the add-on component Installed.
Creating HANA DB based SAP Netweaver Gateway Service

3. 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.

Creating HANA DB based SAP Netweaver Gateway Service

4. 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.

Creating HANA DB based SAP Netweaver Gateway Service

5. 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 )

Creating HANA DB based SAP Netweaver Gateway Service

6. 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.
7. 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.
8. 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.
9. 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.
10. 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.
11. Click on Explore service to test the service. Check for Service Document, Metadata and Entity sets.

Creating HANA DB based SAP Netweaver Gateway Service

Creating HANA DB based SAP Netweaver Gateway Service


Source: scn.sap.com