Setting Up HANA Connection

Objective

After completing this lesson, you will be able to set up HANA Connection.

Database Connectivity Step-by-Step Guide

This lesson focuses on connecting the Universal Model (UM) to databases. The Universal Model shares the same database integration methods as the standard model, facilitating seamless connectivity to both SAP and non SAP systems. We delve into the different options and methods available for establishing these connections.

A diagram showing SAP PAPM on BTP integrating with SAP and non-SAP solutions via DPAgent, APIs, and Cloud Connector, using a HANA database and an Identity Provider.

Step-by-Step Guide to Database Connectivity in the UM

Key Steps: Understanding the various database connection methods, configuring connections, and applying integration options available in both SAP and non SAP environments.

Step 1: Understanding Shared Database Integration

First, it’s crucial to recognize that the Universal Model (UM) shares the same database as the standard model. Therefore, connecting to databases follows similar procedures.​

Key Concepts:

Shared Database: The Universal Model and the standard model use a common database, ensuring consistency in data integration approaches.​

Seamless Transition: Methods applicable in the standard model can be directly applied to the Universal Model.

Step 2: Highlighting Connection Options

Various connection options are available to integrate the Universal Model with different types of databases and systems.​

Key Connection Methods:

SAP ECC via RFC (Remote Function Call): Used for connecting to SAP ERP Central Component (ECC) systems.​

Non SAP Systems: Enabled through standard integration options.​

OData Connections: Opening data to cloud applications for seamless integration.

Step 3: Integrating with SAP and Non SAP Systems

Key SAP Integrations:

SAP ECC: Using RFCs to connect to ECC systems.​

SAP Ariba: Using adapters to connect to Ariba solutions.​

Key Non SAP Integrations:​

Excel Files: Integrating data from Excel for flexible data handling. ​

Database Systems: Oracle, MS SQL, and others through respective adapters.​

Cloud Integrations: Connecting cloud solutions such as Google Cloud, Amazon AWS, and so on.

Step 4: Leveraging OData for Cloud Integration

OData (Open Data Protocol) is a powerful integration method for enabling seamless data exchange with cloud applications.​

Key Steps:

OData Setup: Configure OData endpoints to expose your database to cloud applications.​

Security Considerations: Ensure that proper authentication and authorization mechanisms are in place.​

Data Management: Manage data access and permissions through BTP (Business Technology Platform) for enhanced security and control.

The Cloud Selection Setup

Setting up integration and managing administrative settings are crucial for successful data connectivity and management. Here’s a summary of the steps involved:

Setting Up Cloud Solution:

Access administration settings and configure cloud connections to databases or remote sources.​

Creating and Managing Schemas:

Navigate to schema management, create or use existing schemas, define structure, and set permissions.​

Configuring Integration Settings:​

Fine-tune data synchronization, error handling, and security settings to ensure optimal performance.

A composite image showing the SAP application's Administration Settings UI, and the corresponding UMDEMO data table viewed in the SAP HANA Database Explorer.

HANA Connection Setup Step-by-Step

In this lesson, we set up the first connection to a HANA database. This process involves performing activities at the environment level, allowing you to consume data from the HANA database.

Creating a new HANA Schema connection in an SAP modeling application, starting from the 'Manage Connections' tile.

Step 1: Environment Setup

To consume data from a HANA database, you must first set up the connection at the environment level.​

Key Steps:​

Navigate to Environment Settings:​

Access the environment where the connection is established (Manage Connections application).

Step 2: Creating the Connection

With the environment set, proceed to create the HANA database connection (Picture on the right).​

Key Steps:

Create Connection:​

Within the environment settings, choose the option to create a new connection.​

Provide the necessary database details, such as the database name, host, port, and user credentials.

While activating the connection, user might face a schema access rights issue. The SQL above will allow you to grant the necessary privileges on the schema.

The SAP HANA Database Explorer interface displaying an SQL console with executed queries and the resulting data table for the UMDEMO schema.

Setting Up Inbound HANA Connection

Step 1: Setting Up the HANA Database

Set up our HANA database:

  1. Navigate to the database settings.
  2. We have created a UM demo schema that includes 'table document 1' and 'table document 2', each containing 3 entries.
  3. Additionally, we have a couple of HANA views.•Let's view these artifacts in Universal Model (UM).

Step 2: Creating a Connection in UM

Next, we need to create a connection in UM to bring data from HANA:

  1. Go to the UM model and select the environment where we want to bring in the data.
  2. From here, select 'Connections'. Alternatively, you can access this from the 'Connection' tile, but we'll take this path for simplicity.
  3. We have various connection types here. Select 'HANA schema' for this environment.
  4. Provide a name and description for the connection.
  5. Specify the target schema. Our schema is 'UM demo', but we don’t see it listed. This is because we need to grant access to it first.

Step 3: Granting Access to the Schema

To grant access:

  1. Go back to our HANA database.
  2. Perform a grant as a demo user. We need to perform the grant on our RT user.
  3. First, connect to the 'UM demo' user.•Execute a grant statement on your RT user. Each database has a unique RT user.
  4. To identify your RT user, use a 'SELECT USER' statement or check the schema.•Once access is granted, proceed to the next step.

Step 4: Completing the Connection Setup in UM

Now, return to UM and complete the connection setup:

  • Go back to 'Connections' in UM.
  • Press 'Go', and you should see 'UM demo' available for selection.
  • Select 'UM demo' and click 'Create'.
  • You should now see all four tables and views. It's better to apply a model filter.
  • Save the connection, and you will see only the selected table.
  • If everything looks correct, proceed to 'Sync Model'. This will automatically create a HANA model.

Step 5: Activating the Model and Handling Errors

Next, let's activate the model:

  • Attempt to activate the model. You might encounter an error due to insufficient privileges.•Since we've learned about event logs in the last chapter, let's check the logs for specific error messages.
  • The error message indicates that 'sap UM#00' cannot access the schema. We need to grant the necessary privileges.

Step 6: Granting Specific Privileges

To grant the required privileges:

  • Go back to the HANA console.
  • Provide the specific privilege to the UM user.
  • Attempt to activate the model again.
  • If another error occurs when trying to 'Show Data', it indicates we need to grant 'SELECT WITH GRANT OPTION'.
  • Perform this grant in the HANA console.

Step 7: Verifying the Data Access

Finally, let's verify data access:

  • After granting the 'SELECT WITH GRANT OPTION', go back to UM.
  • Attempt to 'Show Data' again.
  • Now, you should be able to see the data from the 'UM demo' schema successfully.

Setting Up Outbound HANA Connection

Step 1: Setting Up the Outbound Connection

First, let's set up an outbound connection to a HANA schema:

  • Navigate to the 'Connections' section.
  • Create a new outbound connection.
  • Name the connection 'demo IOPHC'.
  • Configure it for outbound data flow.
  • Ensure that the HANA schema is correctly set up without any configuration issues to facilitate smooth data transfer.

Step 2: Filtering and Document Preparation

Next, we need to specify the target document for filtering and writing data:

  • Specify 'document 2' as the target document.

  • Sync the model to prepare it for data writing.

  • This synchronization ensures that our system aligns with the target document, making it ready to handle data operations.

Step 3: Creating the Writer

Now, let's create the writer for the outbound data:

  • Establish a writer named 'Writer 2 Hannah'.
  • Provide a suitable description for the writer.
  • Enter edit mode and map the input fields from the original model entity to the result table.
  • Configure the writer settings accordingly.
  • Save the settings to prepare for activation.

Step 4: Activating and Troubleshooting

Upon attempting to activate the environment, we might encounter errors:

  • Activate the environment.
  • If errors occur, check the event logs for specific error messages.
  • A common issue is insufficient privileges. For instance, we needed to grant INSERT privileges to proceed.
  • Once the necessary privileges are granted, reactivate the environment.
  • Check the writer’s functionality to ensure it operates correctly.

Step 5: Running the Writer

Next, we verify the data transfer:

  • Verify the input data, ensuring it contains the correct entries (e.g., 3 entries).
  • Check the current state of the HANA table (e.g., it has 1 entry).
  • Execute the writer to transfer data from the model to the HANA table.
  • After running the writer, confirm that the HANA table now reflects the expected number of entries (e.g., 4 entries).

Step 6: Handling Errors and Privileges

We also need to handle additional operations and manage privileges:

  • Enable and test additional operations like DELETE and INSERT.
  • If a run fails, check the error logs for specific issues.
  • For example, if DELETE operations fail, grant DELETE privileges.
  • Re-run the process after granting the necessary privileges.
  • Ensure that the data operations (delete, insert) are executed correctly, resulting in the expected state of the HANA table.

Step 7: Best Practices

Finally, let’s discuss some best practices:

  • In a sandbox environment, granting all privileges can simplify testing.
  • However, for customer implementation projects, it's better to manage privileges step-by-step.
  • This approach ensures security and prevents excessive permissions from being granted, maintaining a secure and controlled environment.