Java SDK Overview
For a quick start check out the getting started section.
Why the SAP Cloud SDK for Java?
The SAP Cloud SDK for Java makes it easy to build highly connected, resilient, multi tenant SaaS applications on the SAP Business Technology Platform (SAP BTP). It enables you to perform outbound requests using various protocols while only writing the business logic.
For example, with the SAP Cloud SDK for Java you can connect to an SAP S/4HANA (Cloud) system via OData with only a few lines of code:
HttpDestination destination = DestinationAccessor.getDestination("my-s4-system").asHttp();
List<BusinessPartner> businessPartners = new DefaultBusinessPartnerService()
This example uses the pre-generated OData client together with the destination API to interact with the Business Partner Service of SAP S/4HANA Cloud.
The image below shows a typical architecture of an application built with the SAP Cloud SDK:
Main Features of the SAP Cloud SDK for Java
The SAP Cloud SDK for Java brings a wide variety of features to power your business application.
At its core, the SAP Cloud SDK for Java integrates the SAP BTP Destination and Connectivity services with powerful clients (e.g. OData) in a multi tenant and resilient manner. This integration reduces the code for typical outbound requests down to just a few statements.
The image below visualises the main components of the SAP Cloud SDK for Java.
The SAP Cloud SDK for Java provides an API that abstracts the details of establishing connections to other systems: The Destination API. This API makes it easy to connect to cloud and On-Premise systems with various authentication methods. Under the hood the SAP Cloud SDK handles all the necessary authorization and token flows that are necessary for the specific destination.
You can access destinations defined in the SAP BTP Cockpit directly in your code. Or you can define your own destinations, for example to connect to SAP BTP services.
You can then use these destinations to perform REST (OpenAPI or OData), RFC or SOAP requests. Or you can get a ready-made Http Client for a destination to execute your own requests.
OData and OpenAPI
The SAP Cloud SDK for Java also provides an easy and convenient type safe way to consume OData and OpenAPI services in your applications.
You can use a pre-generated OData client that contains all services of SAP S/4HANA Cloud and SAP S/4HANA On-premise. For select OpenAPI services like SAP Workflow Service and SAP Business Rules Service a client is also already available with the SAP Cloud SDK.
Or you can generate your own API client for OData or OpenAPI using the respective generators provided by the SAP Cloud SDK. You can also find detailed steps and a usage examples on the SAP API Business Hub.
To ensure that applications can handle and recover from potential failures, the SAP Cloud SDK for Java provides abstractions for frequently used resilience patterns.
These patterns include caching, timeouts, retires, rate limiters, circuit breakers and bulkheads.
You can build a
ResilienceConfiguration to define which patterns you need and then use the
ResilienceDecorator to apply them to your operations.
For example, to configure a timeout of 100 ms for an operation:
TimeLimiterConfiguration timeLimiterConfig =
ResilienceConfiguration resilienceConfiguration =
ResilienceDecorator.executeSupplier(() -> operation(), configuration);
You can find more details in our dedicated guide on Resilience.
Multitenancy enables a single instance of an application to serve multiple technically separated user groups. To achieve this the SAP Cloud SDK for Java applies all its features in a tenant and user aware manner by default. For example, fetching a destination with the SAP Cloud SDK will fetch and cache it for the current tenant.
You can access the current tenant or user and other information via the dedicated accessors, for example
This enables you to run any code in a tenant aware manner.
This is achieved using the concept of
ThreadContext and you can read more about this on the dedicated guide on Multitenancy.
Supported Platforms and Environments
The SAP Cloud SDK abstracts away from details of the underlying platform the application is running upon. This enables applications to adopt platform changes or fully switch to a different platform without any code changes.
Currently supported environments are :
- SAP BTP Cloud Foundry
- K8S , K8S with SAP Gardener
- SAP BTP Kyma
- Deploy with Confidence (For SAP internal customers only)
- SAP BTP Neo (Not recommended for new projects)
Supported Java Versions
The SAP Cloud SDK for Java runs with Java 8 or higher. For Spring based applications Java 11 and 17 are supported.
For apps built on TomEE / Tomcat Java 11 is supported.
The SAP Cloud SDK can be integrated into applications based on SAP Cloud Application Programming Model, Spring or Spring Boot.
Availability and Licensing
All libraries are available on Maven Central under the SAP Developer license. The license of clients generated with any of the SAP Cloud SDK code generators depends on the used service spec license.
We usually release minor versions bi-weekly.
We intend to release a new major version of the SAP Cloud SDK for Java every twelve months. For details, check the release policy.
The SAP Cloud SDK is actively supported via various internal and external channels which you can find here.