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: 
Daniel7
Advisor
Advisor
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.

 

Golden Path


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:


































You do... using...

and let the framework take care of...


Define your Data Model CDS

  • automatic deployment to SAP HANA


Define your Services CDS

  • translating to OData service definitions

  • serving requests out of the box

  • authorisation*) and standard validations

  • filling in primary keys and audit information

  • writing trace and audit logs

  • health checks

  • etc.


Add Custom Logic Java or
Node.js


  • handling database connections

  • including tenant isolation

  • parsing input and

  • serialising responses


Add Fiori UIs CDS Annotations

  • translation to OData vocabularies

  • generating a Fiori elements app skeleton


Reuse existing Services
(e.g. from SAP S/4HANA)
CDS Service SDKs

  • Constructing and handling http requests

  • Providing APIs in Java / Node.js

  • Mash-ups with local data




(→ see our Getting Started guides for a more detailed walkthrough)


 

Key Ingredients


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.



In summary:


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.

 

See also...



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.
21 Comments
wouter_peeters
Participant
0 Kudos
Great news! Is it also possible to use this S4 Java SDK outside of the SAP Cloud Platform? ( possible and allowed licensing wise )
Daniel7
Advisor
Advisor
0 Kudos
Thanks.

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?
Daniel7
Advisor
Advisor
Srdjan
Product and Topic Expert
Product and Topic Expert
0 Kudos
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?
former_member184876
Active Participant
0 Kudos
Thank you Daniel.

Exactly the information i am looking for on the new application programming model.
Daniel7
Advisor
Advisor
0 Kudos
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

 
Daniel7
Advisor
Advisor
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:

Thanks,
Daniel
MichaelBeining
Participant
0 Kudos

Hello Daniel,

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:

  • Can one use CDS to define the Data Model and Services for a custom full-stack application and deploy the software artifacts to the HANA Database in SAP CP Neo and as well to SAP CP Multi-Cloud? Is that supported?

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!

Best regards,

Michael

former_member583217
Discoverer
Hey Daniel! Great blog post!


I have a few questions


The first one is actually quite similar to the one above with regards to the deployment on both enviroments, however it adds Multi-Tenancy concerns to the mix: Following the new Application Programming Model, specially when using CDS to  define the Data Model, how would one deal with Multi Tenancy? And if I wanned to define a Schema based Data Isolation, would that still be possible with cds without having to replicate the artifacts for each new Schema?

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!

Best regards,

Gustavo
MichaelBeining
Participant
My question was answered here: https://answers.sap.com/questions/717840/sap-application-programming-model-for-sap-cloud-pl.html

 
Daniel7
Advisor
Advisor
0 Kudos

Sorry Gustavo, I completely missed that one…

ad 1: CAP comes with out-of-the-box multi-tenancy support along these lines:

  • databases are schema-isolated
  • we automatically deploy the respective models to new schemas upon tenant onboarding
  • tenant-specific schema extensions are supported (e.g. tenants may add new entities or extend existing entities or override annotations)
  • at runtime the cds.services framework takes care of tenant-isolation when handling requests

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)

Regards,

Daniel

0 Kudos
Hi Daniel,

 

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.

Thanks,
Amita
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.

Techstack:

  • node.js (CAPm)

  • UI5


Looking forward to hearing from you!

 

Greetings,

Michael
Former Member
0 Kudos
Hello Daniel,

i'm here because of devtoberfest github/youtube series and thank you for sharing.

rgds,

greg
johnmurray
Participant
0 Kudos
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
VitorSeifert
Advisor
Advisor
0 Kudos
Hello Daniel,

 

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.

 

Best regards,

Vitor
OmPrakashJha
Participant
0 Kudos
Very helpful 🙂
alejiandro_sensejl
Active Participant
0 Kudos
Hi daniel.hutzel , great content and very helpful! Any chance to update this blog to 2022 / CAP6, please? 🙏
gregorw
Active Contributor
0 Kudos
Have you read the June 2022 release notes? Also check out the past events especially reCAP 2022.
alejiandro_sensejl
Active Participant
0 Kudos
Hi Gregor,

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. ☺

Cheers,
Alej
Daniel7
Advisor
Advisor
0 Kudos
Good idea... yes, I think it's time for an update blog