Skip to Content
Product Information
Author's profile photo Artem Kovalov

The SAP Cloud SDK – February’21 release highlights

Welcome to the February’21 issue of the SAP Cloud SDK release highlights!

This time we feature a fresh update of pre-generated type-safe client libraries for the latest S/4HANA Cloud 2102 and S/4HANA On-Premise FPS1 releases and multiple other valuable improvements, fixes, and upgrades. We’ll guide you through them in this post and help you upgrade the SAP Cloud SDK to the latest version.

February was active in support

  • We received 31 issues and questions in total
  • 23 of those were answered or solved and closed

Documentation

We brushed up our landing page for instant insights into key SDK value-adds. And released plenty of new materials to enable developers to get the most out of developing with the SDK.

SAP Cloud SDK for Java 3.39.0

Quick links

Pre-generated type-safe client libraries updates for S/4HANA Cloud and On-Premise

There were multiple updates to services including the renaming of methods, change of parameter signatures, and more. We summarized it for you in our release notes in the compatibility section.

OData generator is improved to handle multiple Entity sets belonging to the same Entity type

In the OData v2 and v4 type-safe client (VDM) generators, we now support generating service methods for multiple entity sets belonging to the same entity type. Formerly only the first entity set of an entity type was regarded.

Mind, to ensure backward compatibility this feature is turned off by default.
To activate the new functionality, supply the feature flag explicitly.
Generator Maven Plugin Configuration:
<serviceMethodsPerEntitySet>true</serviceMethodsPerEntitySet>
Generator CLI Flag:
–service-methods-per-entity-set

OpenAPI generator supports vendor extensions and setting of copyright headers

The OpenAPI Generator now allows for customizing the method names on generated API classes. Use the vendor extension x-sap-cloud-sdk-operation-name to specify a name on an operation:

/operation/path:
  get:
    summary: My Operation.
    x-sap-cloud-sdk-operation-name: performMyOperation
    operationId: myOperation

This field is optional and the generator will fall back to using the operationId if vendor extensions are not present.

New API on table parameters of BAPI request

When a table uses a domain-type as row-type there are no field names to refer to. But such a table can be treated as a one-dimensional vector of primitive values, e.g.:

new BapiRequest("BAPI_DEMO", true)
  .withExportingTable("DEMO_TABLE", "BAPI_DEMO_TAB01")
    .asVector()
    .row("CC01")
    .row("CC02")
    .row("CC03")
    .end();

Another improvement was made to support recursive tables and structures in parameters of BapiRequest API for JCo and SOAP protocols.

final BapiRequest bapiReqauest = new BapiRequest("DEMO_BAPI")
    .withExportingTable("TABLE_PARAMETER1","ABC_T_PARAM1" )
    .row()
    .field("ROW_UUID","STRING","foobar")
    //Start nested table
+   .table("TABLE_NESTED1","ABC_T_NESTED1")
+       .row()
+       .field("NESTED_FIELD1","STRING","john")
+       .field("NESTED_FIELD2","STRING","doe")
+       .end() // End nested table
     // START nested structure
     .fields("NESTED_STRUCTURE", "NESTED_STRUCTURE_TYPE")
         .field("latitude", "Axis", "52")
         .field("longitude", "Axis", "13")
         .end() // End nested structure
     .end();

Override default timeout for Cloud Foundry destinations

By default, the TimeLimiter resilience pattern aborts requests to the Destination Service on Cloud Foundry after 6 seconds. If your app requires more time when fetching destinations, you may create your own ScpCfDestinationLoader instance.

// Allow requests to take up to 10 seconds instead of just 6
final DestinationLoader destinationLoader = new ScpCfDestinationLoader(Duration.ofSecond(10));

Simplified API to build destinations for Cloud Foundry

We introduced a new API to build a Destination for connecting to services on Cloud Foundry. The information will be read from the VCAP_SERVICES environment variable at runtime. For certain authentication types i.e. NoAuthentication and OAuth2ClientCredentials this API eliminates the need to manually create a destination in the CF account for connecting to services.

final Map<String, String> mapping =
      ScpCfServiceDestinationLoader.buildClientCredentialsMapping(
        "credentials.endpoints.service_rest_url",
        "credentials.uaa.clientid",
        "credentials.uaa.clientsecret",
        "credentials.endpoints.token_url");

ScpCfServiceDestinationLoader.buildClientCredentialsMapping creates a mapping for loading a destination and provides JSON paths for all required destination properties.

final HttpDestination destination =
      ScpCfServiceDestinationLoader.getDestinationForService(
        "label",
        "serviceBindingName",
        AuthenticationType.OAUTH2_CLIENT_CREDENTIALS,
        mapping);

For certain services like the SAP Workflow Service, we provide further convenience that skips the need to provide the mapping explicitly.

final HttpDestination destination =
      ScpCfServiceDestinationLoader.getDestinationForService(
        ScpCfServiceDestinationLoader.CfServices.WORKFLOW,
        "my-workflow");

How to update?

Navigate to a root folder of your project and find a pom.xml file. Bump the version of com.sap.cloud.sdk dependency to 3.39.0 similar to the XML code snippet below and you’re done! Mind, because Maven Central relying on CDN it takes a bit of time for the new maven module to be distributed.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.sap.cloud.sdk</groupId>
            <artifactId>sdk-bom</artifactId>
            <version>3.39.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
    <!-- possibly further managed dependencies ... -->
</dependencyManagement>

If for some reason your IDE hasn’t fetched an updated dependency version, run mvn clean install from the command line in the root directory of your project.

SAP Cloud SDK for JavaScript

Quick links

Pre-generated type-safe client libraries updates for S/4HANA Cloud and On-Premise

There were multiple updates to services including the renaming of methods, change of parameter signatures, and more. We summarized it for you in our release notes in the compatibility section.

There have been multiple improvements for the OpenAPI code generator

  • writeReadme option was added to generate readme files.
  • We now support generating multiple API objects based on Tags instead of defaulting to one object per an API specification.
  • Generation of transpiled JavaScript OpenAPI clients is supported via generateJS and tsConfig flags.

How to update?

To update the version of the SAP Cloud SDK for JavaScript 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.

Additionally, you can consult NPM for more information on version history and update path.

Feedback

We hope you enjoy developing with SAP Cloud SDK! To help us further improve give your ideas and suggestions in the comments to this blog or create an issue in our GitHub repository.

All the best,

SAP Cloud SDK Team

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.