Integration With Cloud Application Programming Model
This document outlines how you integrate the SAP Cloud SDK into an application based on the SAP Cloud Application Programming Model (referred to as CAP in the remainder).
Check out the tutorial as well
While this document provides a general overview of this topic, we have published a practical tutorial on SAP Developers which illustrates all steps on a comprehensive example.
#
Integration StepsAssumption
The following instructions assume that you have an existing CAP project that can be built successfully. Furthermore, we assume that you deploy your app to the SCP Cloud Foundry environment.
#
Add the SAP Cloud SDK Bill-of-MaterialAdd the SAP Cloud SDK Bill-of-Material (BOM) into the dependencyManagement
section of the root POM.
Here is the XML snippet:
Use latest SAP Cloud SDK version
We recommend using the latest SAP Cloud SDK version always. Check out the release notes to see the release history.
#
Add the SAP Cloud SDK DependenciesAdd the respective SAP Cloud SDK dependencies to the POM file under the srv
directory.
Version information controlled through the SAP Cloud SDK BOM
Note that the version
tags can be omitted, because the previously added the SAP Cloud SDK BOM controls the version of all the SAP Cloud SDK modules.
That is, you only need to increase the version of the BOM and all modules get updated automatically.
tip
The two mentioned dependencies are modules that cover a broad range of possible the SAP Cloud SDK use cases. You may choose a more fine-grained selection of the SAP Cloud SDK dependencies according to your specific use case.
#
Add the Integration DependencyIf your app uses multitenancy features and/or a protected backend, we have to integrate the tenant and user concepts of CAP and the SAP Cloud SDK.
We'll add a respective integration dependency to the POM file under the srv
directory (same place as the previous step).
#
Enable the Component Scan for SAP Cloud SDK PackageLet the Spring component scan crawl the SAP Cloud SDK package.
We'll annotate the Spring Boot application class which is annotated with @SpringBootApplication
as follows.
Make sure that you also add the package name of your application.
Integration finished
Now the SAP Cloud SDK is integrated with the CAP application. You can go ahead using the SAP Cloud SDK features, such as querying OData services.