SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

SAP HANA XS Advanced - Cross-container access

Access objects in an HDI container from another application

Overview

🎓 intermediate 15 min. SAP HANAIntermediateSAP Web Ide

You will learn

  • โœ”How to set up the roles, synonyms and deployment configuration to access objects in a HANA Deployment Infrastructure (HDI) container from another HDI container
Thomas Jung T Thomas Jung November 1, 2022
Created by March 8, 2018
Contributors

Prerequisites

Prerequisites

Steps

Step 1 Create the target container as a resource
โ€”

This tutorial uses the SAP HANA INteractive Education model as an example of a target HDI container. Create this target container by following the XSA-specific instructions found in the SHINE source code repository. In this tutorial, we will refer to this container as the target container.

Your current database module will use two containers, the hdi-container created with the database module and the target container from the SHINE application.

  • If you are using SAP HANA 2.0 SPS04 or later, right-click on the db module and choose New > SAP HANA Service Connection

    Add external SAP HANA Service
    Add external SAP HANA Service

    Choose the service from within the list and click Finish.

    Add external SAP HANA Service
    Add external SAP HANA Service

    Continue with step 2.

  • If you are using SAP HANA 2.0 SPS03, right-click on the db module and choose Modeling Actions->Add External SAP HANA service

    Add external SAP HANA Service
    Add external SAP HANA Service

    Choose the service from within the list and click Finish

    Add external SAP HANA Service
    Add external SAP HANA Service

    Continue with step 2.

  • If you are using SAP HANA 2.0 SPS02 or lower:

    Find out the name of the target container using command xs s from the command line interface (CLI):

    Check service name
    Check service name

    The CLI client can be executed from a HANA express command line as user hxeadm or downloaded to your computer using the download manager available after you register to download SAP HANA, express edition Open the mta.yaml file in your consuming application and go to the Resources tab. Create a new resource of type org.cloudfoundry.existing-service.

    Call it consumed-core-container and a new parameter with service-name as a key and the name of the service from command xs s

    Check service name
    Check service name

    Add a property with key consumed-service-name and value ${service-name}

    Check service name
    Check service name

    Save the mta.yaml file. Open the consuming hdi-container resource definition and take note of the name of the variable that has the service name assigned to its value:

    Check resource name
    Check resource name

    Select the consuming database module and add a property with key TARGET_CONTAINER and refer to the variable set with the name of the consuming hdi-container:

    Add resource
    Add resource

    Add group SERVICE_REPLACEMENTS with key consumed-db and the value of the variable used to hold the value of the service name in the consuming hdi-container (consumed-service-name in this example).

    Add resource
    Add resource

    Except for the name of the hdi-container from the external application and the environment variable service-name, the names of the variables can be adjusted to fit your needs.

As a reference, the relevant parts of the mta.yaml file in this example look like this:

YAML
modules:
  - name: form_data
    type: hdb
    path: form_data
    requires:
      - name: hdi_form_data
        properties:
          TARGET_CONTAINER: '~{hdi-container-name}'
      - name: consumed-core-container
        group: SERVICE_REPLACEMENTS
        properties:
          key: consumed-db
          service: '~{consumed-service-name}'
resources:
  - name: hdi_form_data
    parameters:
      config:
        schema: FORMS
    properties:
      hdi-container-name: '${service-name}'
    type: com.sap.xs.hdi-container
  - name: consumed-core-container
    type: org.cloudfoundry.existing-service
    parameters:
      service-name: 'XSA_DEV-zkway5plof6jgxab-hana-shine-xsa-shine-container'
    properties:
      consumed-service-name: '${service-name}'
Step 2 Check or create roles in the target container
+
Step 3 Create a grants file
+
Step 4 Create synonyms
+
Step 5 Use the synonyms in a view
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Create the target container as a resource 2. Check or create roles in the target container 3. Create a grants file 4. Create synonyms 5. Use the synonyms in a view

Learn more →