Skip to Content
Here, we will access the HANA Sandbox system from an ABAP system. The ABAP system has database like MaxDB. We will access HANA DB (HDB) from this ABAP system as a secondary DB.
This is the example which connects ERP system with HANA system.
Pre-condition(s):
SAP HANA DBSL is needed (this is the Database specific library which is part of the ABAP Kernel). The SAP HANA DBSL is only available for the ABAP Kernel 7.20, which is already the kernel for NetWeaver 7.02, 7.03, 7.20, 7.30 and 7.31. So make sure, the ABAP system you use has valid release of Netweaver.
/wp-content/uploads/2013/06/precond_236286.png
 
Steps:
  1. Create Connection:
    • Create/Get a user (prefer a generic user) in HANA sandbox:  I created ‘EBSCLNT001’.

               /wp-content/uploads/2013/06/hanauser_236263.png

              
    • Note the connection (host) information from HANA Sandbox:
      /wp-content/uploads/2013/06/hana_c_info_236282.png
    • Create DB connection in ABAP system: Transaction SM30, table DBCON.  You need to give the HANA Sandbox username/password created in step 1(a). Give the connection information from step 1 (b). Give a connection name such as ‘HANA_COE_EBS’.


     2. In the user specific schema, you need to create your own tables/views etc., manually/programatically (via ABAP). Table SFLIGHT created in schema EBSCLNT001.
        
     /wp-content/uploads/2013/06/tab_sflight_236283.png
     3.  Accesing this table from ABAP Program (ABAP System where DBCON setting was done):


Sample code:

DATA: flight TYPE sflight,
      t_flight 
LIKE TABLE OF sflight,
      wa_flight
LIKE LINE OF t_flight.

* Single Record
SELECT SINGLE * FROM sflight INTO flight
  CONNECTION
(‘HANA_COE_EBS’) WHERE carrid = ‘AA’.
IF sysubrc IS INITIAL.   WRITE: / ‘Successful access to HANA Sandbox COE!’,/,/ENDIF.

* Multiple records from HANA table
SELECT * FROM sflight INTO TABLE t_flight CONNECTION (‘HANA_COE_EBS’).
WRITE: /‘Data from Table SFLIGHT, no. of records: ‘, sydbcnt.
LOOP AT t_flight INTO wa_flight.
 
WRITE: / wa_flightcarrid, wa_flightconnid, wa_flightfldate.
ENDLOOP.


Execute: You will get all the records!
/wp-content/uploads/2013/06/abap_results_236284.png

You can try this with any ABAP system with appropriate Netweaver release and HANA Sandbox.
 
Also refer the blog(s) here for more detailed information:

    
    
To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Uwe Fetzer

    Unfortunately your pictures are stored on the SAP intranet and cannot be seen outside the network. Can you please upload them to SCN? Thank you

    (0) 

Leave a Reply