Skip to Content
Author's profile photo Former Member

Get Your HANA Data From Everywhere With Netweaver Gateway

With SAP Netweaver Gateway SP04 HANA Database data can be accessible from Gateway system. And I started to search for a document for this. I accessed a SAP Help url but it is very short. (Document Link). But there are some limitations for SAP HANA. You can read them from this link.

First install HANA client on your Gateway Server:

Unix(Logon with root):

hdbinst -a client -p /usr/sap/<SID>/hdbclient -s <SID>

Windows(Logon with SIDadm):

hdbinst -a client -p <lw>:\usr\sap\<SID>\hdbclient

Create a new db entry in DBCON table. To achieve this enter transaction code DBCO.

/wp-content/uploads/2012/07/1_122814.png

Now we can create Model Class. Go to transaction SE24. Create a new class. And define Superclass. Superclass is: “/IWHDB/CL_HAI_RT_ABS_MODEL”

/wp-content/uploads/2012/07/2_122822.png

Now redefine GET_HDB_ARTIFACTS method and write code. Dont forget to change code with your catalog name and view name.

data: lr_view_assgmnt type ref to /iwhdb/s_hai_rt_view_assgmnt.
 rt_views = super->get_hdb_artifacts( ).
 append initial line to rt_views reference into lr_view_assgmnt.
 lr_view_assgmnt->catalog_name = 'demo'.
 lr_view_assgmnt->view_name = 'AT_SALES'.

/wp-content/uploads/2012/07/3_122823.png

Save and activate your class.

Go to transaction SPRO. Click SAP Reference IMG button. Go to SAP Netweaver -> Gateway Service Enablement -> Backend OData Channel -> Service Development for Backend OData Channel. And click “Execute” button near Maintain Models.

/wp-content/uploads/2012/07/4_122825.png

Enter your Technical Model Name and Model Version your models and click create. In the next screen enter your class name above created.

/wp-content/uploads/2012/07/5_122826.png

Save your work. And enter IMG Activity Maintain Services. In this screen enter your Technical Service Name and Service Version and click Create button. In Data Provider Class input field enter “/IWHDB/CL_HAI_RT_DATA”. Save your service and click Assign Model. Choose you created below Technical Model and save again.

/wp-content/uploads/2012/07/6_122827.png

Now we need to create a BAdl Class. We need to do this because system does not know which dbcon entry to use. I dont write how to create a BAdl because I think you know it. In implementing class we implement “/IWBEP/IF_DESTIN_FINDER_BADI~GET_DB_CONNECTION” method. In this method we tell system which DBCON table entry to use. You can check name above. And if you have one more HANA systems you can write own logic to select system.

  rv_db_connection = 'AWSHANA' .

/wp-content/uploads/2012/07/7_122828.png

Now we will register a service and use it. Go to transaction /IWFND/MAINT_SERVICE (I dont like Gateway transaction codes!). Add a new service.

/wp-content/uploads/2012/07/8_122829.png

/wp-content/uploads/2012/07/9_122830.png

Choose your service before you created. Enter your Technical Model Name and Technical Service Name. Enter package name $TMP. If you want you change package name.

And if everything is ok we can test your service.

/wp-content/uploads/2012/07/10_122846.png

And yes! We got data from SAP HANA!

/wp-content/uploads/2012/07/11_122848.png

/wp-content/uploads/2012/07/12_122852.png

/wp-content/uploads/2012/07/13_122853.png

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Andy Silvey
      Andy Silvey

      Hi Erhan,

      great blog.

      Thanks,

      Andy.

      Author's profile photo Alvaro Tejada Galindo
      Alvaro Tejada Galindo

      Hey Erhan!

      You never send me the link...this is really nice man...good job! 😀

      Greetings,

      Blag.

      Author's profile photo Former Member
      Former Member

      Uhhmm yes I forgot, sorry 🙁

      Thanks for good comment!

      Author's profile photo Former Member
      Former Member

      Hi Erhan,

           I do as you say in this blog except /IWBEP/IF_DESTIN_FINDER_BADI, I create a new class, and implement this interface, add my dbcon information into the method GET_DB_CONNECTION,but I don't know how to use it class? should I add this class into service? If I directly redefine the interface /iwbep/if_destin_finder_badi, the system told me I can't modify this method.

      I think this thing causes my service having 500 internal error when I explore this service. but I am not sure. could you please give me a hint? Thanks.

      Author's profile photo Former Member
      Former Member

      Hi,

      You will implement BAdl. You will use transaction se19 not se24. I think you should get help from an ABAPer.

      Author's profile photo Former Member
      Former Member

      Hi

      Thank you for your reply so quickly. I use se19 to create a new enhancement implement, but the message popped up says "System setting does not allow changes to be made to

      object ENHO /IWBEP/IF_DESTIN_FINDER_BADI", where should I change this setting?

      Author's profile photo Former Member
      Former Member

      Hi

      You will put "/IWBEP/ES_DESTIN_FINDER" to Create Implementation->New BAdl->Enhancement Spot. Then press create implementation button.

      Author's profile photo Former Member
      Former Member

      Hi

      Yes, I have done this , and I enter           

      Enhancement Implementation: /IWBEP/IF_DESTIN_FINDER_BADI

      Short Text:test

      Composite Enhancement Implementation:


      A error message popped up like this.

      System setting does not allow changes to be made to

      object ENHO /IWBEP/IF_DESTIN_FINDER_BADI

      Author's profile photo Former Member
      Former Member

      Enhancement Implementation must start with Z, it is custom impl. And also Composite enhancement implementation must start with Z.

      I think you should get help from an ABAP guy. He will do this steps in a few minutes.

      Author's profile photo Ethan Zhang
      Ethan Zhang

      Great post.

      However, I followed up the steps but run into a dead-end.

      Our NW and Gateway are running on different server, IMG on NW couldn't configure ODATA Channel, while on Gateway /IWHDB/CL_HAI_RT_ABS_MODEL doesn't exist and ZHANA_BLOG couldn't been found.

      I'm lost here and couldn't carry on, kindly help.

      Thanks

      Ethan

      Author's profile photo Former Member
      Former Member

      Very useful information Erhan about the HANA..

      thank you....

      Author's profile photo Former Member
      Former Member

      Hello Erthan,

      I have followed the step you listed above in your blog. But seeing below error when I am trying to activate service.

      No Model assigned to Service'XXXX' First assign model first. But I can see model assigned to service in SPRO.

      Can you please suggest me I am missing anything which causing this error.

      GW_service_model.JPGGateway_activation_error.JPG