SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Use the SAP Cloud SDK in the SAP Cloud Application Programming Model

Create a SAP Cloud Application Programming Model project to call OData services using the SAP Cloud SDK on Cloud Foundry.

Overview

🎓 intermediate 40 min. SAP Cloud Application Programming ModelIntermediateSAP Cloud Sdk

You will learn

  • โœ”How to integrate the SAP Cloud SDK into the SAP Cloud Application Programming Model
  • โœ”How to write a custom event handler for CAP Java
  • โœ”How to deploy an application to SAP Cloud Platform Cloud Foundry
  • โœ”How to create service that reads/writes business partners from S/4HANA and exposes them as SAP Cloud Application Programming Model
Matthias Kuhr M Matthias Kuhr January 25, 2024
Created by August 26, 2020
Contributors

Prerequisites

Prerequisites

Steps

Windows macOS Linux BAS

Intro

SAP Cloud Application Programming Model enables you to quickly create business applications by allowing you to focus on your business domain. It offers a consistent end-to-end programming model for full-stack development on SAP Cloud Platform. However, this raises the question how this interacts and integrates with other SAP frameworks that SAP has introduced over the past year such as the SAP Cloud SDK. In particular, you will learn how to integrate the SAP Cloud SDK into the SAP Cloud Application Programming Model. And how the SAP Cloud SDK allows you to develop, extend and communicate with other SAP solutions.

Also check out the full documentation on how the Cloud SDK integrates with CAP.


Step 1 Create SAP Cloud Application Programming Model project
โ€”

For local development, you need to do the following:

  1. Install Node.js from https://nodejs.org (use the latest LTS release).

  2. Install the cds development kit globally:

    Shell
    npm i -g @sap/cds-dk
  3. Now, run:

    Shell/Bash
    mvn archetype:generate -DarchetypeArtifactId=cds-services-archetype -DarchetypeGroupId=com.sap.cds -DarchetypeVersion=RELEASE \
    -DartifactId=cap-business-service -DgroupId=org.your.org.cap.test

    This will initialise the application using the maven archetype cds-services-archetype and create your project as follows:

    • The project is named cap-business-service.

    • The db folder stores database-related artifacts.

    • The srv folder stores your Java application.

      project creation done
      project creation done

Find more information about the SAP Cloud Application Programming Model in its documentation.

Step 2 Define a data model
+
Step 3 Define a service
+
Step 4 Integrate SAP Cloud SDK
+
Step 5 Create Java class for event handler
+
Step 6 Understanding the read and write methods
+
Step 7 Run the mock server
+
Step 8 Run the application
+
Step 9 Create/read data through Postman
+
Step 10 Deploy and configure mock server on cloud foundry
+
Step 11 Deploy application to Cloud Foundry
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 11
1. Create SAP Cloud Application Programming Model project 2. Define a data model 3. Define a service 4. Integrate SAP Cloud SDK 5. Create Java class for event handler 6. Understanding the read and write methods 7. Run the mock server 8. Run the application 9. Create/read data through Postman 10. Deploy and configure mock server on cloud foundry 11. Deploy application to Cloud Foundry

Learn more →