About This Tutorial
This tutorial is divided into multiple sections:
- Setup tells you about tools you need, setting up a NestJS application, and its project structure.
- Execute an OData Request will give you a deeper insight into using an OData client to execute requests against an SAP S/4HANA service.
- Deploy Application to Cloud Foundry informs you about managing destinations in Cloud Foundry in SAP BTP.
About the Application
The application will use the business partner client library and connect to an SAP S/4HANA Cloud system. It will fetch a list of business partners and provide the result to a service endpoint that users can consume. You will leverage several of the SAP Cloud SDK features such as:
- request builders to build OData requests for available request types.
- destination lookup for destinations created manually or referenced by name.
- execute method to construct request URL and headers, execute the request, and return a typed response
This tutorial assumes you have a basic knowledge of the following:
- TypeScript: programming concepts like functions, arrays, etc.
- Cloud Foundry: spaces, cf CLI.
- SAP Business Technology Platform: concepts such as destinations, UAA services.
For deploying your application to Cloud Foundry in SAP Business Technology Platform, you will need an account. You can get a trial account here or use an existing account if you already have one.
You also need to have access to an SAP S/4HANA Cloud system with a technical user. If no SAP S/4HANA Cloud system is available, you can set up a mock server or use a sandbox API as described below.
You can set up a local mock server by following the instructions here. This server hosts an OData v2 mock service that mimics the business partner API. It does not support all the features of the actual OData services, but it suffices to try it out locally. Once it is up and running you should see the list of services at http://localhost:3000.
Alternatively, many APIs can also be tested using the sandbox of the SAP Business Accelerator Hub. To use the sandbox, you need an API key. Go to SAP Business Accelerator Hub and click Login in the top right corner. If you do not have an account, you will need to register first. When you are logged in, click on Hi name in the top right corner and then click on Settings in the dropdown menu. On the settings page, click Show API Key.
After reading the tutorial, you will learn how to do the following tasks:
- Consume an SAP S/4HANA service in your application.
- Use the SAP Cloud SDK to perform
GETrequests against an SAP S/4HANA Cloud system.
- Create and configure a destination and use it in your application.
- Deploy your application to a Cloud Foundry space.