Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
HenningH
Advisor
Advisor
0 Kudos
The new version of the SAP S/4HANA Cloud SDK Java libraries is available since today. You can update your dependencies to version 2.13.2 and consume the new version from Maven Central.
In this blog post, we will walk you through the highlights of this release. 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


Improved support for MultiChain blockchain (beta)


In version 2.5.0 of the SDK, we released experimental modules for easily interacting with SAP Cloud Platform Blockchain service. In particular, we provided generic support for Hyperledger Fabric and basic support for MultiChain blockchains.

Thanks to a contribution of the team behind SAP Cloud Platform Blockchain, version 2.13.2 introduces a new experimental module blockchain for interacting with MultiChain blockchains in the SAP Cloud Platform Blockchain service. This new module replaces the previous classes for MultiChain, which have been deprecated as a consequence. The existing classes for interacting with Hyperledger Fabric stay as before.

For interacting with MultiChain blockchains, consider the new experimental classes. Compared to the previous, now deprecated API, the new MultichainService offers fluent and type-safe access to various MultiChain commands, like publishing a new item to a stream:
String txid = MultichainService.create()
.publishStringAsHex(stream, keys, "value to publish", null);

The blockchain team plans to release a blog post and tutorial with more information soon.

Improve performance of OData VDM via caching


For converting requests and responses, the OData virtual data model (VDM) relies on the metadata of the respective OData service. To verify at runtime, it was so far necessary to fetch the metadata for each OData request.

The OData VDM now allows caching the metadata of OData services in order to improve performance by reducing the number of HTTP requests made for each OData call. To enable caching for a request, use the method cachingMetadata on fluent helpers for each request that shall use cached metadata. Only the first such request against a particular service per tenant will retrieve the metadata from the service. Following requests will use the cached metadata.

By default, metadata will not be cached and instead still be fetched for each request, as before. Please note that as of now it is not possible to invalidate the cache, so use of this feature is only advised where changes to the OData service are rare.

Further improvements


When using the JwtBasedRequestContextExecutor to run code using the SDK in a new context, you can now easily run operations on behalf of specific tenants without having to provide a corresponding JWT yourself. Use the new method onBehalfOfTenant to execute code in a context for the tenant with the given tenandId. Based on this value a JWT access token will be generated and used internally. The content of the JWT can further be influenced with the optional parameters issuerUrl and audience. Depending on the code executed on behalf, certain token audiences may be required. If no URL is provided, the SDK will use the default to match the XSUAA service URL expected for the subscribed tenant.
new JwtBasedRequestContextExecutor()
.onBehalfOfTenant("abcd1234-...", null, "my-xsappname!x123")
.execute(() -> {
// code executed on behalf of given tenant
});

 

Version 2.13.2 updates the dependency to the Java libraries of the SAP Cloud Application Programming Model to version 1.27.0 (from 1.24.0).

We have fixed an issue where HttpCachingHeaderFilter did not add HTTP response headers in certain situations. For example, when the consuming application is using JAX-RS, the filter operation was not triggered in the past. With the new implementation, the cache headers will be set in these cases as well. It is now recommended to place the filter at the end of the filter chain, instead of the beginning.

Following up on the new Message VDM released in version 2.11.1, we have published a new blog post that explains how to use the Message VDM to react on business events from SAP S/4HANA Cloud.

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 sdk-bom dependency.

  • Update the version of that dependency to 2.13.2.


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>2.13.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
<!-- possibly further managed dependencies ... -->
</dependencyManagement>

If you are using the SAP S/4HANA Cloud SDK in a project of the SAP Cloud Application Programming Model, replace sdk-bom with sdk-modules-bom to only update the version of SDK modules, not further dependencies.
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 2.13.2.

Of course, you can also generate a new project that uses version 2.13.2 from the start by running the Maven archetypes for Neo or Cloud Foundry with -DarchetypeVersion=2.13.2 (or RELEASE).
3 Comments