Skip to Content

The new version of the SAP S/4HANA Cloud SDK Java libraries is available since today. You can update your dependencies to version 2.7.0 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.

Start of OpenSAP Course

The openSAP course on the SAP S/4HANA Cloud SDK starts in less than one week. Don’t forget to register today! Starting next Wednesday, November 14, you will learn all there is to know about building and delivering Cloud-native extensions to SAP S/4HANA with the SAP S/4HANA Cloud SDK.

As a special treat and incentive, the 35 course finishers with the highest final course score will win a free copy of our book Extending SAP S/4HANA! So don’t miss out on this chance and do participate from the first day. For more details, refer to our blog post on the course.

Java Libraries: Release Highlights

Version 2.7.0 is mostly a maintenance release with some bug fixes, listed in the full release notes. For example, we fixed a bug in the Java Virtual Data Model (VDM) where multiple calls to orderBy would result in the query to only contain the ordering expression of the last method call. Now, the request will correctly chain the order expressions according to the order in which the method is called.

One new functionality of version 2.7.0 is the ability to wrap one request context in another request context. A RequestContext holds central information about the context of the current request, such as the current tenant, destinations, and other information accessed via the SDK’s accessor classes. Before introducing the new capability, there could only be one request context (automatically created or manually initiated) and nesting was not possible. Certain scenarios may require initiating a new request context (using a RequestContextExecutor) in cases where a request context is already present, for example, to switch the tenant context. Now, you can explicitly specify when configuring a RequestContextExecutor that it is expected that a request context already be present. The executor will execute the wrapped code in the new request context and revert to the parent context afterwards. By default this is disabled and nesting will throw an exception. You must enable this functionality explicitly by using the withParentRequestContext() method:

new RequestContextExecutor()
    .withParentRequestContext()
    .execute(() -> {          
        //logic with nested requests
}

Several further improvements and bug fixes, for example, in the area of audit logging, 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.7.0.

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.7.0</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 2.7.0.

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

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply