We have released new versions of the
SAP Cloud SDK. In detail, the following components are now available in new versions:
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,
for the JavaScript libraries, and
for the continuous delivery toolkit. 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 versions.
Java Libraries: Release Highlights 2.17.0
You can update your dependencies of the SAP Cloud SDK for Java to version 2.17.0 and consume the new version from
Maven Central.
Update of Java VDM to SAP S/4HANA Cloud 1905
Recently, SAP released
SAP S/4HANA Cloud 1905.
With version 2.17.0, the SAP S/4HANA Cloud SDK updates the
virtual data model (VDM) for OData services of SAP S/4HANA Cloud to support all newly released or updated OData services of an SAP S/4HANA Cloud 1902 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 usual, the Java representations of all OData services are available from the package
com.sap.cloud.sdk.s4hana.datamodel.odata.services.
Further improvements
We have fixed a connectivity issue in the internal HTTP client where URIs would be encoded twice, leading to incorrect request URIs if the URI contained characters that need to be encoded.
Version 2.17.0 fixes an issue with the
detection of changed fields for update requests in the OData VDM. Those had mistakenly been converted to upper-case, which led to incorrect change detection when using classes generated via the
OData VDM generator.
Several further improvements are listed in the
full release notes.
JavaScript Libraries: Release Highlights 1.3.0
The
JavaScript libraries of the SAP Cloud SDK are now available in version 1.3.0.
Update of Java VDM to SAP S/4HANA Cloud 1905
Like the SDK for Java (
see above), the SDK for JavaScript also updates the OData VDM for easily accessing OData services to the recently released version
SAP S/4HANA Cloud 1905. You can find the modules representing the latest state of SAP S/4HANA Cloud APIs as modules named
@Sisn/cloud-sdk-vdm-*
in the
global list of SDK modules.
Support for custom fields
The OData VDM for JavaScript now supports custom fields of OData entities. Custom fields are properties that are not part of the standard API but added, for example, via in-app extensions in SAP S/4HANA. The OData client of the SDK deserializes custom fields when retrieved via an OData service request and serializes custom fields on create and update requests. We offer the method
getCustomField
for retrieving and
setCustomField
for setting a specific custom field on an entity, as well as
getCustomFields
for retrieving all custom fields and
hasCustomField
for checking if a custom field exists.
Entity types such as
BusinessPartner
provide a method
customField
to reference custom fields in select or filter query options.
The following code snippet illustrates the use of the new capabilities to handle custom fields:
const CUSTOM_FIELD_NAME = 'YY1_AddrLastCheckedBy_bus';
var businessPartner = await BusinessPartner.requestBuilder()
.getByKey('1003764')
.select(BusinessPartner.BUSINESS_PARTNER,
BusinessPartner.customField(CUSTOM_FIELD_NAME))
.execute({
destinationName: 'MockServer'
});
// ...
if( businessPartner.hasCustomField(CUSTOM_FIELD_NAME) ) {
var originalValue = businessPartner.getCustomField(CUSTOM_FIELD_NAME);
businessPartner.setCustomField(CUSTOM_FIELD_NAME, 'New value');
// ...
}
Further improvements
In the OData VDM, we now provide a static representation (for example,
BusinessPartner.ALL_FIELDS
) on each entity type for all fields of that entity. This representation can used in select query options to retrieve all fields when also expanding navigation properties. For example, to retrieve all fields of the business partner and expand the associated addresses, selecting also all of their fields, use the following code:
BusinessPartner.requestBuilder().getAll()
.select(BusinessPartner.All_FIELDS,
BusinessPartner.TO_BUSINESS_PARTNER_ADDRESS)
//...
We have also fixed an issue where OData properties of type
Edm.DateTime
were not serialized or deserialized correctly. Now, timezone offsets are correctly taken into account.
As usual, the
full release notes contain a list of all improvements in this release.
How to Update
Java libraries
To update the version of the SAP 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.17.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.17.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
<!-- possibly further managed dependencies ... -->
</dependencyManagement>
If you are using the SAP 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 Cloud SDK in version 2.17.0.
Of course, you can also generate a new project that uses version 2.17.0 from the start by running the Maven archetypes for
Neo or
Cloud Foundry with
-DarchetypeVersion=2.17.0
(or
RELEASE
).
JavaScript libraries
To update the version of the SAP Cloud SDK JavaScript libraries used in an existing project, use the command
npm update
in the root folder of your module. Note that this will also update other modules, unless you explicitly specify which packages to update. If you want to check beforehand what will change, use
npm outdated
.