Skip to main content
SAP Cloud Application Programming Model

What’s the SAP Cloud Application Programming Model?

By 26. May 2021June 23rd, 2021No Comments

That’s the question I asked myself a few months ago. I didn’t know that writing a book about the SAP Business Technology Platform would lead me to more questions than I cared to ask. Simple questions weren’t so easy to answer. I couldn’t detail every topic in the book, but I’d like to share my thoughts with you. It was an exciting experience, and I hope you find it helpful.

In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web, both for front-end and back-end applications. This has led to significant projects like SAPUI5, Angular, React, and Vue that improve developer productivity and enable the creation of fast, testable, and extensible front-end applications. But, while many excellent libraries, helpers, and tools for Node.js (and server-side JavaScript), none of them solve the fundamental problem – architecture.

CAP provides an out-of-the-box application architecture that allows developers and teams to create testable, scalable, loosely coupled, and maintainable applications. SAP optimized the framework for SAP BTP SAP Cloud Foundry environment but enables other settings as well.
When considering building an application for the SAP BTP using the SAP Cloud SDK, such as an extension to SAP ERP, take some time to investigate whether the SAP Cloud Application Programming Model (CAP) can support your efforts. CAP is a framework for building robust, scalable server-side applications. It enables developers to prototype applications locally and then refine them using the actual cloud services you want to use. It’s available for two programming languages, JavaScript with TypeScript support and Java. Core Data Services complement these programming languages.

CAP combines elements of OOP (Object Oriented Programming), FP (Functional Programming) and FRP (Functional Reactive Programming). Behind the scenes, it leverages robust HTTP server frameworks like Express that let you build enterprise-ready APIs based on REST and OData services. CAP abstracts details such as this common Node.js framework giving you the ability to replace this implementation detail should there be better options. This abstraction for flexibility and replaceability of used services and implementation details is an essential theme of CAP. But why did SAP develop such a framework in the first place?

Why an SAP Cloud Application Programming Model?

To understand the origin of the SAP Cloud Application Programming Model, you need to understand the history of classic SAP projects. SAP systems are standard software. This means that they offer functionalities that many companies similarly need. You can customize the settings of these functionalities to a certain extent. Yet to adapt the system and processes to their approach, many companies access options for enhancement.

SAP has integrated most of the functionality you need to extend an SAP system into the same system. SAP ERP comes with its extension workbench and programming language, ABAP. This allows developers to work efficiently, as they don’t have to worry about common aspects like authentication and setting up databases. They can set necessary permissions, but the SAP system already provides all the user management, logging. It’s nothing developers had to think about or worry about.

But, as the number of enhancements and modifications increases, updates to the SAP system become expensive and cumbersome. Changes sometimes have to be retested, and the resources needed to do so are scarce. Since ABAP resources are scarce, they are costly. Over time, a maintenance backlog builds up and grows.

Over time, requirements have shifted. Customers ask for more functionality faster and with a better experience. The web has become more important and SAP released, with some intermediate steps, SAPUI5, a framework for implementing user interfaces with SAP’s Fiori design guidelines using JavaScript.
The ability to modularise and scale parts of a system is also more important than it used to be. Rapid prototyping, change and customization are prerequisites.

Under the slogan “Keep the Core Clean,” SAP recommends against making deep enhancements in the core system itself. Suppose firms over-customize the system at the base level. In that case, it becomes harder to connect new applications and data sources without breaking the system. Customization is good because it can bring forward tuned efficiencies. Still, you need to do it at a higher level inside the SAP platform through standardized Application Programming Interfaces (APIs) rather than down at the kernel. If you do all this successfully, your modifications and customizations can sit with a ‘clear contract’ outside the core.

Your business must meet the demanding requirements of your customers. Developers need to translate these requirements into software reliably and efficiently. Running and hosting applications in the cloud is the future. The trend in almost all industries is toward the cloud because it helps speed up business.

For application development, your developers need a consistent and optimized environment. You need a stable platform that delivers the services you expect without impacting the usability of other applications or disrupting the production environment. But it’s not just about cost savings and simplifying IT operations. In the cloud world, you need to be responsive, agile and able to react to change.

Yet delivering applications to your customers requires a strategic approach to development. In the cloud, you don’t have to worry about provisioning or maintaining your infrastructure. Instead, you can focus on application development. It doesn’t take long to develop an application and then deploy it to their account. The biggest challenge is creating and maintaining that application. In doing so, you need to think about aspects that used to be taken for granted with ABAP. Where does my user identity come from? How do I integrate authorization into the application? What kind of logging framework can we use?

You need a stable framework for business application development. During the lifetime of an application, many changes may be necessary. Even though we are talking about architecture here, an application is not a building but a garden. You need to maintain and service software if you don’t want it to rot.
The application needs to work even if you want to change the underlying infrastructure or business logic. App development is complex. Moving to the cloud also opens up modern programming models and various languages for developers to create innovative applications that are more powerful and scalable.
The ability to deploy a cloud application with a small of effort is a compelling selling point. But deploying to the cloud comes with a lot of complexity. Besides, building a production-ready application in a cloud environment can intimidate developers.

SAP created the Cloud Application Programming Model with precisely this in mind. Customers familiar with deploying, maintaining and developing SAP applications have turned to SAP with questions about developing in the cloud. SAP wants the framework to make it easier for developers to use SAP services and systems while taking advantage of the cloud. This includes, for example, SAP S/4HANA and SAP Business Technology Platform. Using the Java and JavaScript programming languages also gives companies other advantages – the ecosystem and resources are much larger than for ABAP.
You want to make sure your cloud application development project runs smoothly and users have a fantastic experience. Your developers are looking for guidance and best practices for cloud application development. The SAP Cloud Application Programming Model guides developers through the cloud application lifecycle – from ideation to deployment. It enables developers to focus on the application’s business logic and build applications that directly address business objectives. It also enables the creation of applications that are fast, secure and scalable. The goal is to drive business value by building applications in cloud environments.

In doing so, developers save time writing code to perform recurring tasks, such as saving data changes. This allows them to build scalable software to meet increasingly complex requirements while dramatically reducing time-to-value.

Developers can focus on your business domain, so you can quickly get applications that benefit your business. You focus on more critical aspects of your business and application development while keeping application development costs in check.

The SAP Cloud Application Programming Model is an effective way to develop applications and services in the cloud. It provides developers with the ability to rapidly develop, test, and deploy applications using proven best practices. The framework comprises a mix of widely used open source and SAP tools and technologies.

Proper app development and testing are an essential part of delivering a high-quality product. Also, the continued stability of the SAP Cloud Application Programming Model is critical to ensuring that those who rely on SAP products have an easy and predictable way to benefit from them.
SAP CAP aligns developer and business interests to achieve business goals while reducing development costs. This structured approach allows developers to focus on business logic and reduce complexity while streamlining progress. The benefits are obvious: fewer hurdles to overcome and less time spent on repetitive tasks and underlying technology.

The building blocks of the SAP Cloud Application Programming Model

Now that you know the context let’s look at the building blocks used to achieve this goal. The SAP Cloud Application Programming Model is a framework of languages, libraries, and tools for building enterprise-grade services and applications. It aims to guide developers on a safe path with proven best practices and a wide range of out-of-the-box solutions for recurring tasks.

CAP-based projects benefit from a focus on the application domain. Rather than delving into overly technical disciplines, the focus is on accelerating development and protecting investments in a world of ever-changing cloud technologies.

The SAP Cloud Application Programming Model is both open and opinionated. This is precisely one of the guiding design principles. The model provides guidance but also freedom; it supports both open source and SAP tools and technologies.

Besides open-source technologies, CAP relies primarily on Core Data Services (CDS) as a universal modeling language for both domain models and service definitions. CDS is the backbone of the programming model and provides the ability to capture service definitions and data models, queries, and expressions in simple object notations.

Then, developers put in place business logic using service SDKs and runtimes. Service SDKs and runtimes for Node.js and Java provide libraries for implementing and using services defined with CDS and generic provider implementations that automatically serve many queries. For both Java and Node.js, there are libraries that allow developers to provide and consume services through synchronous and asynchronous interfaces (APIs). The SDKs include out-of-the-box integration with lower-level platform services, such as authentication and logon workflows with the XSUAA service or on- and off-boarding of SaaS tenants on the SAP BTP.

Thanks to the white-box approach, you can also access the native functionality of the underlying technologies if needed. The framework is open because it gives you a choice. You can choose which technologies and architectural patterns you want to use. You can select the parts of the programming model that best fit your development needs.

But it is also opinionated because it provides guidelines, best practices, and tools that allow you to follow a recommended approach. SAP created the programming model to find the best path for cloud development.

SAP developed the framework and is not yet open-sourced, but it provides first-class support for SAP services and tools. You can use SAP HANA as the database and SAP Business Application Studio (BAS) as the IDE. For both products, there are out-of-the-box features that can speed up your development project.

But, CAP does not require you to use any of these services or products. There is no restriction. There is no mandatory path you must follow with this programming model.

You can use SAP Fiori Elements to build your user interfaces following SAP Fiori guidelines, but you can also work with alternative technologies or guidelines. The point is not to force you to use one or the other. It’s about giving you the freedom of choice.

You could also use PostgreSQL as your database of choice, use Visual Studio Code as your IDE, and build user interfaces with React. There are official extensions for VS Code. However, there is a caveat – if you use PostgreSQL as your database of choice, you will need a community extension, and SAP does not currently provide support for these community extensions. If you want help from SAP, you are limited to the officially supported options.

There are out-of-the-box features for SAP technologies, such as SAP Event Mesh, that can speed up your schedules. You don’t have to use them, but you can combine them as you see fit. The programming model is unobtrusive and tries to remain free of assumptions. One goal is to reduce redundant code, which remains the same regardless of the architecture or method you choose.

The framework currently allows APIs to be built using pure REST services or OData services, a specific subset of REST. So currently you can define an OData service using CDS and have it running out of the box with the generic service implementations. However, since the implementations are interchangeable, it could support other options such as GraphQL in the future.

Last but not least, the programming model is platform-independent. You can build applications in a way that is independent of the underlying cloud infrastructure. CAP achieves this through an API-centric approach that avoids hardwiring to a specific technology.

You could use a SQLite database locally to develop the application quickly and connect your service, still running locally, to the SAP HANA DB running in your SAP BTP subaccount.

So with CAP, you can choose technologies, from development language to UI technologies to databases of your choice. You can select your architecture patterns from multi-tenancy and microservices to CQRS and event sourcing.

The framework supports some of these choices out of the box – others need to be implemented as part of a project. In doing so, CAP gives you guidance and support for repetitive tasks without limiting you. You can use CAP as a whole or just the parts that suit you.

Let’s recap: There is support for SAP technologies, but they also designed it to integrate with alternative solutions. CAP is free of assumptions. It helps your developers avoid redundant code by putting conventions above configuration and avoiding hardwiring to a specific platform through higher-level APIs. In this way, the framework allows you to replace outdated technology easily with a modern one.


So what is the SAP Cloud Application Programming Model?

It’s a framework from SAP that lets you deliver business value faster by allowing your developers to focus on business logic. CAP saves you money by reducing the effort required to program the application and recurring tasks, and by making it easier to connect to SAP and potential third-party services. It protects your investment by making the underlying technology interchangeable, allowing you to keep pace with cloud technologies.
The SAP Cloud Application Programming Model is our framework of choice for creating modern side-by-side extensions for SAP systems or applications on SAP platforms.

What do you think about it? Do you prefer to use RAP with ABAP or another open-source framework?

Leave a Reply