SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




Install SAP Free


Create Database Connection to SAP HANA Database in S/4HANA


ABAP developers can create database connection to HANA databases using Database Connection Maintenance DBCO transaction on a SAP system. Using DBCO tcode or RSDBCONN ABAP program, developers can connect to a HANA database as a secondary connection to SAP system with a valid HANA database user authentication data. In this HANA tutorial, I want to show steps for defining a second database connection to a HANA database with DBCO tcode and how to verify if the connection is successfully created or not.

Create Database Connection to SAP HANA Database

Logon to SAP system that you want to create a second database connection to a remote HANA database system.
Then launch SAP transaction code DBCO for Database Connection Maintenance screen.

If you will be creating a new database connection for the first time on that SAP system, the list will be empty.

/p>

Switch to change mode and press New Entries button to create a new database connection on SAP.
Here is the initial database connection creation screen on DBCO transaction.

create new database connection to SAP HANA database

First of all, type a descriptive name to your new database connection.
As the second step, choose the DBMS type (which stands for Database Management System).
This DBMS selection is very important because according to the selected DBMS the connection properties that the ABAP programmer should provide on the definition screen will change.
Since we target SAP HANA Database connection, choose HDB for the DBMS selection.

DBMS database management system list including SAP HANA Database

The third step is providing a valid user authentication information; a valid database username and its database password.
Please note that every time you make a change on this screen, you should provide the password for the HANA database connection user.

The Connection Info field shows the target HANA Database system that we aim to connect using this new database connection.
It is possible to get the database connection information if you are already connected to the HANA database on SAP HANA Studio.
Right-click on the SAP HANA system and display Properties screen.

SAP HANA Database system properties

On Additional tab, programmers can find the connection details like Host data. This is the connection information we will add on database connection creation screen on DBCO transaction.

HANA database connection information

Then save the new database connection information for SAP HANA Database


Test HANA Database Connection on SAP

To test new created database connections using DBCO transaction code on a SAP system, ABAP programmers can execute ABAP report ADBC_TEST_CONNECTION
Using SE38 or SA38 transaction codes, execute ABAP program ADBC_TEST_CONNECTION

Then in DB Connection Name input area choose the database connection that you want to test

test database connection on SAP

Simply execute the ABAP program using F8 or clicking on execute icon

If the database connection was correctly defined, you will have a response on the screen from the program similar to following:
Testing a Database Connection Defined in DBCON
Connection KODYAZ successfully opened.
Connection KODYAZ closed

Using this SAP HANA Database connection, an ABAP programmer can execute native SQL code on the database directly. For a basic sample of executing native SQL statement on SAP HANA Database please refer to execute SQL on HANA database from ABAP using secondary database connection






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table








Copyright © 2004 - 2018 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems