Discovering Connectivity in SAP BTP

Configuring Destinations and Consumption

Objective

After completing this lesson, you will be able to manage destinations across levels and implement secure connectivity with Cloud Connector and approuter.

Destinations

Leveraging existing services and data sources is the core of each cloud-based business application out there. Connecting applications to those destinations is a crucial element of your application and should be done the right way.

Destinations contain connection information. They're the key building blocks in SAP BTP, used to define connections for outbound communication from your application to remote systems. These remote systems can be on-premise or in the cloud. A destination has a symbolic name, URL, authentication details, and some other configuration details. The consumption of destinations depends on the environment and is part of the connectivity concept for each SAP BTP environment.

Managing Authorizations for Destinations

SAP BTP Cloud Foundry application uses Approuter to access Destination Service and web resources.

To manage, create, change, or consume a destination within SAP BTP, you need to ensure that the administrator and developers have the correct authorizations. For destination-specific predefined roles and further information, you can look at: Technical Connectivity Roles and Operations [Feature Set B].

Compare Destination Levels in SAP BTP

Destinations can be maintained as environment variables, on the subaccount level, or on the service instance level via the SAP BTP cockpit.

Maintaining destinations as environment variables has the disadvantage that the configuration is bound to the application code and cannot be changed.

Since destination configurations on subaccount level require the Org Manager role, the recommendation for destination creation is to create a service instance of the SAP Destination service in its own space. This enables full configuration when having the respective space roles. The destination configuration can be done via the SAP BTP cockpit – within the respective service instance, via CF CLI, or via REST API.

Comparison of destination scopes: subaccount-wide, service-instance specific, and immutable environment-variable destinations.

Subaccount Level Destination

All destinations defined on the subaccount level are available to all Destination service instances, which means that you can use one destination in multiple SAP Destination service instances.

To create a destination on the subaccount level:

  1. Log in to your global account, and choose Subaccount.
  2. Expand the Connectivity menu, and choose Destinations.
  3. Create a new destination using the Destination Editor.

Service Instance Destination

The second approach is to create destinations directly in an SAP Destination service instance. These destinations will only be available in the Destination service instance they are defined in and can be overwritten by destinations on the subaccount level.

For example, if we create a destination called Northwind on the subaccount level and in the destination service instance, each destination would have a different URL and the destination service would use the configuration defined in the subaccount.

To create a Destination on the service instance level:

  1. Open your subaccount, and choose Services→Instances and Subscriptions→Create.
  2. Select Destination Service as the service instance type, and choose the appropriate plan (for example, lite), runtime environment, space, and instance name, and create the instance.
  3. Navigate to Instances, select the instance you created, and bind it to your application. (Alternatively, you can also use the cf CLI or an MTA file for binding.
  4. Consume the destination. (Please have a look at this Technology Blog by SAP for a more detailed description of the whole described process: Destinations in SAP Business Technology Platform.)

Environment Variable Destination

SAP BTP app uses environment variables, XSUAA, Destination Service to access on-premise or web services.

Destination information could also be stored and provided using environment variables. Using the application router (or approuter) for your Cloud Foundry application, you can use the environment variable destination. The variable contains an array of objects with destination information.

The following URL outlines the environment variables available for configuring the application router. It includes a brief description of each variable and, where applicable, an example of the configuration data: Environment Variables.

The Destination service lets you find the destination information that is required to access a remote service or system from your Cloud Foundry application.

  • For the connection to an on-premise system, you can use this service together with the Connectivity service.
  • For the connection to any other web application (remote service), you can use the Destination service without the Connectivity service.

Consuming the Destination service includes user authorization via a JSON web token (JWT), provided by the XSUAA service.

The approuter can reference configured destinations by their names in its xs-app.json file. If the approuter forwards a request to a back-end service, it can also forward the generated token (JWT), by configuring the forwardAuthToken parameter as an additional property in the destination configuration.

In addition to the approuter, other services and applications can also bind to the Destination Service instance. After the binding, the application retains all binding information, including the credentials in the environment variables, which are needed to retrieve the destination configuration. Using the SAP Cloud SDK library eases the retrieval of the Destination configuration within the application code; the library is available for Java and JavaScript.

For more information about the consumption of destination services in the SAP BTP, Cloud Foundry Environment, see: Consuming the Destination Service.

Connect to Internal Business Systems

SAP BTP Connectivity supports the following communication protocols and scenarios:

HTTP(S)

Exchange data between your cloud application and Internet services or on-premise systems.

  • Create and configure HTTP destinations to make web connections.
  • Connect to on-premise systems via HTTP, using the Cloud Connector.
RFC

Invoke on-premise ABAP function modules via RFC.

  • Create and configure RFC destinations.
  • Make connections to back-end systems via RFC, using the Cloud Connector.
TCP

Access on-premise systems via TCP-based protocols using a SOCKS5 proxy.

To connect to on-premise systems, a Cloud Connector must be set up in the respective subaccount. Various authentication mechanisms exist to connect to an on-premise system and can be configured inside the destination configuration of the Destination service. Cloud Connector connections and Destinations are subaccount dependent.

Options for Creating and Changing Destinations

There are four ways you can create a destination:

  • SAP BTP Cockpit

    Uses the normal SAP BTP cockpit user interface to create the destinations.

  • Destination Service REST API

    This method is only available for destinations in combination with a Cloud Foundry environment. You can call the API methods to maintain destinations.

  • Destinations with MTA Descriptor

    You can use the multitarget application (MTA) descriptor to manage destinations for complex deployments.

  • Destinations of Service Instance Creation

    While creating a destination service instance, you can provide a JSON-based configuration to create destinations.

Not all capabilities of maintaining destinations are available for all four ways. You can get the details here: Managing Destinations.

You can change a destination anytime it's needed. In addition to that, you can even download and import destinations to, for example, transfer them to another subaccount of SAP BTP. You can always do a connection check for the destination, and you can create a new destination based on an existing one. Destinations can have additional properties.

Summary

  • Destinations store connection information and authentication details for outbound communication to remote systems across different levels.
  • Cloud Connector and approuter enable secure connectivity patterns for accessing internet resources and on-premise systems via HTTP, RFC, or TCP.