Introducing the Cloud Application Programming Model (CAP)
We are excited to announce general availability of the new Cloud Application Programming Model. To understand what it adds, let’s consider the following scenario:
Cathy, an application developer, was given the task of creating a cloud-based application that integrates with existing data from a SAP S/4HANA backend, adds some new fields to it, as well as a “propose/approve” process to create new entries. And she’s given only a few days to get that done.
Wouldn’t it be great if she could simply reuse the existing data model from the ABAP backend and just apply the necessary extensions? And as one is used to in SAP S/4HANA, just expose and serve that extended model to Fiori UIs?
And of course: to not spend most of her time worrying about things like implementing metadata providers, serving $metadata requests as well as each individual CRUD requests, i18n and localization, filling in auditing data, code lists and value helps, extensibility and customization, multi-tenancy, resilience, and so on, instead of focusing on her actual tasks.
These kind of questions led us to rethink how we could easily build cloud-based business applications within an SAP ecosystem. The result is what we call an (enterprise) application programming model: It guides application developers along a golden path of best practices allowing them to focus on their domain problems to solve instead of wasting time and efforts in technical disciplines and hard-to-maintain boilerplate code. How? By providing a set of enterprise-grade tools, languages and libraries that relieve them from technical disciplines.
Following the golden path of the programming model helps you implement data models, services and UIs in order to develop stand-alone business applications or extend other cloud solutions, like SAP S/4 HANA or SAP SuccessFactors.
In essence, the recommended way to build applications is as follows:
and let the framework take care of…
|Define your Data Model||CDS||
|Define your Services||CDS||
|Add Custom Logic||Java or
|Add Fiori UIs||CDS Annotations||
|Reuse existing Services
(e.g. from SAP S/4HANA)
|CDS Service SDKs||
(→ see our Getting Started guides for a more detailed walkthrough)
The figure below depicts the key building blocks and technologies which constitute the new programming model. The overarching approach is:
We use CDS to capture data models as well as service definitions on a conceptual level. These CDS models serve as input to frameworks on data, service and UI layers (indicated by the arrows in the graphic) where they are translated to native artefacts – for example, SQL database schemas, or OData $metadata documents – as well as interpreted to automatically serve requests at runtime.
Core Data & Services (CDS) – we adopted CDS*) as known from SAP S/4HANA and ABAP to define data models as well as service interfaces on a conceptional level. As with SAP S/4HANA, you can annotate the CDS models with annotations for Fiori UIs.
(Generic) Service Providers that interpret CDS models to automatically serve metadata and CRUD requests out of the box.
Service SDKs for Java and Node.js, which facilitate reuse of and integration with existing services in the cloud.
Data Access Layers which use the CDS models to support higher-level data access options. For example, from data models in CDS we generate corresponding sets of JPA classes.
SAP Business Application Studio and tools tailored for the new programming model such as CDS Editors, Code Assists, Outline Views, new Project Explorer, etc.
Key Qualities & Benefits
We already emphasised the key focus on application development tasks, golden path of best practices and the automation of time-consuming tasks. There are still two more qualities we want to highlight:
1. No abstraction, minimal overhead
While we provide easy to use interfaces to things like databases, we do not introduce abstractions. Means: You always have access to all native capabilities, for example, to leverage the power of SAP HANA.
2. Openness, freedom of choice
Even though we provide advanced support for and integration of the recommended set of technologies (→ see Golden Path above) we are not locked-in to them. In particular, you can add and use your preferred databases instead of SAP HANA, can build UIs without Fiori can use other tools in local setups instead of SAP Business Application Studio.
By using declarative approaches like CDS, plus a combination of enterprise-grade tools and services, and a golden path of best practices, we greatly increase developer productivity and speed up the development process. This means we significantly reduce time to market. Moreover, this ensures many essential non-functional features, like multi-tenancy, extensibility, supportability and maintainability.
The golden path is recommended, but not mandatory. With our application programming model, you are not locked-in and can choose whichever path you are more comfortable taking.
- capire – our official documentation at cap.cloud.sap
- Building Applications with CAP – our openSAP course
- Cloud Application Programming Model (CAP) – start here by DJ Adams
- Build a Business Application with Node.js – Starter Scenario by Iwona Hahn
- SAP Business Application Studio is Generally Available! by Nir Kol
In addition, find more related tutorials and blogs tagged with “SAP Cloud Application Programming Model”. Also visit our <strong”>official community page at https://community.sap.com/topics/cloud-application-programming.
*) based on a new, modular and lightweight implementation of CDS, that allows fast release cycles, with an enhanced feature set and openness for other databases than SAP HANA.
Great news! Is it also possible to use this S4 Java SDK outside of the SAP Cloud Platform? ( possible and allowed licensing wise )
Yes, indeed many pieces can technically be used in varying environments, including the new CDS implementation, the service SDKs, etc. which is one of the reasons for open and modular design principles we chose to pursue; gives us flexible ways to combine things going forward. License-wise still needs follow ups; not decided yet in all cases.
I understand, your question specifically goes to the SAP S/4 HANA Cloud SDK?
Use the SAP S/4HANA Cloud SDK in the Application Programming Model for SAP Cloud Platform by Daniel Foehr
Which approach/model/SDK shall be used to leverage the existing business functionality, of Purchase Order (MExx) or Sales Order (VAxx) for example, on SCP?
The Application Programming Model as introduced here. It comprises the usage of S/4 HANA Cloud SDK for service-level integration to S/4 as well as other services on the Cloud Platform
Thank you Daniel.
Exactly the information i am looking for on the new application programming model.
Hi all, this is a very short notice to all who joined our sessions at TechEd and want to get their hands on the things shown among those sessions focused on service layer in Node.js.
While the Node.js version is already available GA as well right now from npm.sap.com, we had some delays regarding making all that a really sound and rounded-up thing (TechEd always swallows quite some capacity, you know). I do want to apologise for that and ask you to stay tuned for an upcoming release due very soon.
Tutorials, API reference documentation and Getting Started in a Nutshell guides are in the makes enabling you to do the exercises we showed at TechEd.
For the time being, please see also:
great blog post! Do you know if the SAP Help pages have been moved? All the links seems to be dead… ?
Currently I am trying to find the answer to the following question:
My aim is to build/define a Custom-Full-Stack app which is able to be deployed/operated on both SAP CP environments (Neo & Multi-Cloud). If my understanding of the SAP Application Programming Model is correct, this is one of the aims of it, right?
I am just curious because I came across differences of the SAP HANA programming model on Neo (supports only XS) and on Multi-Cloud (supports only XSA).
Thanks for your inside!
My question was answered here: https://answers.sap.com/questions/717840/sap-application-programming-model-for-sap-cloud-pl.html
Second question: What version does the OData service produced by the CDS entities supports? Can you configure such version?
Third question: Does the OData service produced by the CDS views supports Delta Tokens and Delta Queries out of the box? If not, is there any project for adding such functionality?
Thanks in advance!
Sorry Gustavo, I completely missed that one…
ad 1: CAP comes with out-of-the-box multi-tenancy support along these lines:
ad 2: We support OData v2 and OData v4 (→ we recommend to use v4). CDS models are agnostic. You can compile them to v2 or v4 on demand using the CLI option `–odata-version`, e.g. as in:
cds compile your-service.cds –to edmx –odata-version v4
ad 3: We currently are implementing Delta Queries (using delta tokens) in combination with reliable paging (allows to continue with the recent chunk in case a lengthy response is broken after chunk 100 or so)
Hi there Daniel,
We are currently trying to implement our service via CAPm and are now at the point of needing to support multi-tenancy. We would like to isolate every tenant in a schema, so to use HANA nomenclature for every onboarded tenant we want an HDI container.
Now to the problem we can not seem to figure out how to do this in the CAPm framework. I searched through the documentation and the code and the only thing I could find is the multiTenant flag on the connect function and that the tenant extensions are implemented.
What I couldn't find is the implementation of the subscription callbacks (onSubscription, getDependencies) specified here.
I also couldn't find the automatic deployment on subscription and switching of HDI containers on a request from a specific tenant user.
Our current workaround is doing it ourselves, we implemented a CDS middleware that intercepts the incoming request and defines the run method on that request context with the correct HDI container connection. But since we read everywhere that this stuff is already supported out of the box I hope you could point us in the right direction.
Looking forward to hearing from you!
Hi Daniel, I appreciate this is a very old comment and post but is there any more information on the implementation of Delta Queries/Tokens? This comment is the only reference I can find to it anywhere so I'm wondering if the implementation was put on hold maybe? Thanks, John
This blog is very helpful 🙂
I had a question regarding tenant unaware database. We basically have two databases, Tenant aware and tenant unaware. We are basically looking for a UI using CAP services to access both databases.
It would be great if you could tell me whether this is possible or could connect me with anyone/any blog which explains this part.
i'm here because of devtoberfest github/youtube series and thank you for sharing.
Thank you for this very helpful blog! One remark: the picture on the "Key Ingredients" section is not loading. It seems that the link to the picture is broken.
Very helpful 🙂
Hi Daniel Hutzel , great content and very helpful! Any chance to update this blog to 2022 / CAP6, please? 🙏
Have you read the June 2022 release notes? Also check out the past events especially reCAP 2022.
yep, also the August release notes regarding Cap6.1. This blog was a great entry point for me back then to learn what CAP is about the first time and I would appreciate an updated version as reference to new colleagues and hopefully also get them caught in CAP web. ☺
Good idea... yes, I think it's time for an update blog