The new version of the SAP S/4HANA Cloud SDK Java libraries is available since today. You can update your dependencies to version 1.9.2 and consume the new version from Maven Central.
In this blog post, we will walk you through the highlights of these releases. For a complete overview, visit our release notes for the Java libraries. The release notes also include the change log of all our releases so far.
At the end of the article, you will find a set of instructions on how to update to the new version.
Java Libraries: Release Highlights
Virtual Data Model for SAP S/4HANA Cloud 1802
Recently, SAP released SAP S/4HANA 1802.
With its version 1.9.2, the SAP S/4HANA Cloud SDK updates the OData virtual data model (VDM) to SAP S/4HANA Cloud 1802 to support all newly released or updated OData services of an SAP S/4HANA Cloud 1802 system. As explained in the blog post about the VDM itself, the VDM greatly simplifies reading and writing data from an SAP S/4HANA system in your Java code.
You can use the SDK to connect to all OData services listed in the SAP API Business Hub for SAP S/4HANA Cloud.
As part of the update of the VDM, we also further improved the ease of use and consistency of the VDM. To this end, we renamed the Java representation of many services. For example, a service whose representation as a Java interface in the VDM before had the complex name
CreateAndUpdateCommercialProjectsService is now simply called
CommercialProjectService, with the same functionality as before. Most likely, code that uses the VDM needs to be adapted by adjusting the package and class names. For more details on the changes and a straightforward transition path, take a look at the compatibility notes that are part of the release notes.
AppToAppSSO with Cloud Foundry destination service (beta)
Application-to-application Single Sign-On (AppToAppSSO) is used when two applications on SAP Cloud Platform communicate with each other and the calling application wants to propagate the currently logged-in user to the called application. The destination service (beta) in the Cloud Foundry environment of SAP Cloud Platform also allows creating a destination with AppToAppSSO as authentication type.
With version 1.9.2 of the SAP S/4HANA Cloud SDK, we transparently support AppToAppSSO authentication in the Cloud Foundry environment as part of our SAP Cloud Platform abstractions. When you use our
HttpClientAccessor to send a request to a destination with AppToAppSSO, the SAP S/4HANA Cloud SDK handles the necessary authentication flow in the background. You only need to set up the correct bindings to the destination service (beta) and the UAA service. The two instances of the UAA service bound to the calling and called application need to trust each other by granting and accepting scopes. See our deep dive on microservice communication for more details.
A short explanation of what happens in the background during AppToAppSSO, in case you are interested: If a normal user session is available, for example, during a Servlet request, the user’s authentication information (JWT token) will be included as part of the headers of the request to the destination. If no user session is available, for example, during a background task, a new application access token is created from the authorization and trust management service (UAA) and passed as part of the request to the destination.
As part of our effort to provide a simple integration of third-party frameworks to SAP Cloud Platform apps, we introduce a ready-to-use
exception mapper for Spring applications in a new module
com.sap.cloud.s4hana.frameworks:spring-web. You can use this exception mapper in your Spring-based application to get a safe and helpful error handling by default. The exception mapper logs all unhandled exceptions with a reference ID and fills the response with the error description, without the stacktrace.
The environment variable
destinations so far available for Cloud Foundry-based applications can now be used independent of the underlying Cloud platform environment, enabling consistent local testing of connectivity across environments. For an introduction to this topic, study our blog post.
For applications in the Neo environment of SAP Cloud Platform, we now transparently support the location ID of the SAP Cloud Connector used to route destinations to on-premise networks in case multiple Cloud Connectors are connected to the same subaccount.
We have simplified the generation of new projects when using one of the archetypes for Cloud Foundry. The project generated by such an archetype now sets the
random-route property in
manifest.yml instead of asking for a unique hostname. If you want to specify a specific URL for your application, take a look at the documentation of the routes property.
The Javadoc of the modules for integration of third-party frameworks such as Hystrix or Togglz (classes in packages
com.sap.cloud.sdk.frameworks.*) has been improved to make it easier to use the corresponding functionality of the SAP S/4HANA Cloud SDK, which integrates popular Java libraries into applications that run on SAP Cloud Platform and provides necessary glue code out of the box.
Version 1.9.2 fixes a bug that appeared when using version 1.8.0 in multi-tenant applications on SAP Cloud Platform Neo, where running in non-container managed threads would always use the tenant context of the provider, not the consumer account. Upgrading to this version from the previous version is highly recommended when using Neo the SDK in a multi-tenant application in the Neo environment.
We also fixed two issues that impacted the deserialization of properties of OData entities in the VDM. Properties with complex types as well as binary properties are now correctly handled.
Several further improvements are listed in the full release notes.
How to Update: Java Libraries
To update the version of the SAP S/4HANA Cloud SDK Java libraries used in an existing project, proceed as follows:
- Open the pom.xml file in the root folder of your project.
- Locate the dependency management section and therein the
- Update the version of that dependency to
With this, you are already done thanks to the “bill of material” (BOM) approach. Your dependency should look like this:
<dependencyManagement> <dependencies> <dependency> <groupId>com.sap.cloud.s4hana</groupId> <artifactId>sdk-bom</artifactId> <version>1.9.2</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> <!-- possibly further managed dependencies ... --> </dependencyManagement>
You can now recompile your project (be aware of the compatibility notes, though) and leverage the new features of the SAP S/4HANA Cloud SDK in version 1.9.2.