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
Product and Topic Expert
Product and Topic Expert
8,917
TypeScript and JavaScript developers, this is for you: the SAP Cloud SDK (fka SAP S/4HANA Cloud SDK) is now available for JavaScript. Today, we are proud to release version 1.0.0 of the SAP Cloud SDK for JavaScript. This is the first generally available, productive version of the libraries for JavaScript, after the beta that started in October last year.



Similar to the SDK for Java, the SAP Cloud SDK for JavaScript makes it easy and delightful to develop extensions to SAP S/4HANA as applications on SAP Cloud Platform. The SAP Cloud SDK for JavaScript helps you to integrate SAP S/4HANA into your Cloud-native applications written in TypeScript or JavaScript, running in Node.js. You can execute those applications locally or deploy them to SAP Cloud Platform, Cloud Foundry.

Continue reading below if you want to get the high level picture on the most helpful features of the initial release and on how to access the JavaScript libraries of the SDK. If you want to get started quickly, head over to our tutorial series and begin using the SDK for JavaScript today. Like the SDK for Java, the SAP Cloud SDK for JavaScript is available free-of-charge under SAP Developer License.

Capabilities of the SDK for JavaScript


The following describes on a high-level the most important features. For more details, refer to the release notes and the API documentation in JSDoc.

Easy access to SAP S/4HANA Cloud APIs


Accessing SAP S/4HANA Cloud can be as easy as follows - no boilerplate, low-level code, just business logic:
import { BusinessPartner } from '@sap/cloud-sdk-vdm-business-partner-service';

BusinessPartner.requestBuilder()
.getAll()
.select(BusinessPartner.LAST_NAME)
.filter(BusinessPartner.FIRST_NAME.equals("John"))
.execute({destinationName: "S4HANACloud"})
.then(businessPartners => {
// process result of type BusinessPartner[]
}).catch(reason => {
// handle error
});

This is made possible by the OData Virtual Data Model (VDM, also known from the SDK for Java). The OData VDM of the SDK for JavaScript provides a TypeScript/JavaScript representation of the OData API of SAP S/4HANA Cloud, including all services, operations and entity types listed on the SAP API Business Hub. In a similar manner as the code snippet above, you can access not only reading, but also writing operations (function imports are not yet supported).

Straightforward integration of SAP Cloud Platform


The code snippet above also illustrates the out-of-the-box integration with the destination service on SAP Cloud Platform for managing the target system, or destination, and authentication credentials. Don't worry if you missed it at first glance – it's easy to miss thanks to the straightforward integration: when calling execute on an OData VDM request, you pass the name of a destination, in this case, S4HANACloud. That's it, the SDK will take care of resolving the destination defined in the destination service on SAP Cloud Platform and perform the required authentication.

If you prefer, you can also define the destination manually. In addition, it's easy to substitute the destination service with simple environment variables when running locally or during tests.

TypeScript or JavaScript?


The above example uses TypeScript, a typed superset of JavaScript. If you are only familiar with JavaScript, you may not even have noticed, though. In fact, the above code is also perfectly valid JavaScript. The SAP Cloud SDK for JavaScript has been implemented in TypeScript, and can be used in JavaScript and TypeScript project alike. Both JavaScript and TypeScript developers can use the same libraries and get the same features, and both will benefit from the code completion capabilities enabled by TypeScript, given an editor with corresponding support. TypeScript projects of course will benefit from additional type-safety.

We can only encourage everyone to check if TypeScript suits his needs. If you don't want to use TypeScript, it is still perfectly fine to stick to plain JavaScript and use the SDK in JavaScript.

Continuous delivery pipeline


The continuous delivery toolkit is a core component of the SAP Cloud SDK, because it enables projects to continuously deliver their application without additional effort for setting up a continuous delivery pipeline. We are happy that we are able from the very beginning to provide this out-of-the-box continuous delivery pipeline also for JavaScript projects.

To this end, we provide two project scaffolds, one for TypeScript and one for JavaScript projects. They out-of-the-box include everything needed to run the continuous delivery pipeline on a Jenkins server. You do not have to write a single line of pipeline code to benefit from the best practices codified in the pipeline, only configure it to your project environment. For more details on what is supported, take a look at the release announcement for version v17 of the continuous delivery toolkit.

How to Access the JavaScript Libraries


The JavaScript libraries of the SAP Cloud SDK are freely accessible from SAP's npm registry. SAP's registry works like the standard npmjs registry for resolving JavaScript modules. It hosts packages of the scope @Sisn. All you need to do to be able to retrieve the SDK modules, which are all provided with scope @Sisn, is executing the following command:
npm config set "@sap:registry" "https://npm.sap.com"

Afterwards, pick any module of the SDK listed on the module overview in the documentation and install it as a dependency into your Node.js project, for example:
npm install @sap/cloud-sdk-vdm-business-partner-service

Thank You!


Thanks a lot to the whole development team for the effort and dedication to make the release possible. We would also like to thank the many partners and customers that participated in the beta. Their feedback helped shape the version 1.0.0 of the SAP Cloud SDK for JavaScript.
Here's what two SAP partners participating in the beta had to say:

  • Lars Schubert, managing director of graphomate GmbH, said about the SDK: "Our first tests of the SDK were very promising and we are excited to implement productive applications with it." Jonas Vogler, Head of Software Development at graphomate GmbH, summarized the experience of the development team with the SDK as "easy to use, nice, reliable. That’s the future."

  • Scott Stefanich, solution architect at pmc America, Inc., enjoyed working with the beta of the SAP Cloud SDK for JavaScript specifically because of the OData virtual data model: "The virtual data model is excellent. The combination of type-safety and auto-completion really improves your productivity and allows to focus on the task at hand."


Now, we would like to invite everyone to experience this for themselves, use the SDK, ask questions on Stack Overflow, and give open feedback.
40 Comments