SAP CAP: Cloud Application Programming model: Deep-dive

What is it and what can I do with it as a developer?

For several years, SAP has made a new technique available for building custom applications. Besides the fact that we as developers can build Fiori applications on existing techniques using SEGW services and RAP, we can now do the same with CAP. In the previous article on CAP, you can read the basics of what it is and what benefits it offers within your organization. In this article, we take a deep dive into the technology and learn more about what you can really do with it as a developer.

What is CAP?

In case you haven’t read Part 1, just a quick summary: CAP is nothing more and nothing less than a framework of programming languages, code libraries and tools that can be used to build large-scale applications. This implicitly uses proven best-practices and many out-of-the-box solutions for common tasks. This rather abstract definition already reveals an important aspect of CAP; it is a combination of building blocks that can be used to build an application.

With the use of CAP, the focus is on the problem domain rather than the technology. A developer does not have to worry about the exact technical implementation of, for example, the physical tables in the database, this is all done implicitly by defining the data model in a fairly simple notation. Because of this, the developer will have to carefully create this domain model together with the functional experts, which automatically puts the focus on functionality, not so much on technology. CAP discourages the manual implementation of storing technical fields such as unique identifiers, values in different languages and meta-data. For these, standard solutions are available in CAP.

CAP is most clearly summarized in the figure below.

INNOV8iON-SAP-CAP-Cloud-programming
overview CAP

Without going into too much detail, we will explain the various components seen in the image.

Platforms and infrastructures

We start at the bottom at the light gray block “Platforms and Infrastructures. The image above shows that CAP can be used on, and with, different platforms and infrastructures. CAP applications can be deployed on platforms such as Cloud Foundry and can leverage data from on-premises systems.

Run times

The block above it ‘Runtimes’ indicates that the actual technical implementation can be done in multiple programming languages. For now, a developer can choose to build the CAP application in Java (Spring framework) or in JavaScript (Node.js framework).

CAP as a center point

Next we come to the core, the block called “CAP. Within this we see 4 different cubes. ‘Core data services’ are the definitions of our data models, or a reflection of our problem domain. ‘Enterprise services’ are the definition of the data services and underlying logic. You can think of this as a projection of our data model. Here we indicate what data from the model becomes visible, in what way that happens, what you can do with that data, and what custom logic is built in. ‘Connectors’ means that we can incorporate various services from the BTP, or from outside (think third-party and open source products), into our application. Here the ‘Identity & Auth’ service is an important possibility; this service can handle the authentication of users within our application. With that, we have also highlighted the entire block of ‘Platform services’ on the right. Finally, in the middle we then have the ‘Adaptors’ block. This block indicates that we can make our services, which are created on our data model, available to a front-end application using various techniques. Think of the well-known service definition OData that many SAP developers can handle. Again, the developer is free to choose what best suits the use case. This also highlights the ‘Protocols’ block.

Front-end

That leaves us with 1 more block; the top “Front ends. This block indicates that different UIs can be built within a CAP application. With this, physically different applications can be built on 1 service, but you can also choose different UI techniques. You can use SAP’s well-known techniques such as SAP Fiori Elements and SAPUI5, but you can also choose to use other well-known UI frameworks such as React or Vue.js.

In summary, a CAP application is composed of several building blocks that can be used to create a full-stack application for a wide range of different use cases.

Benefits of CAP

We can conclude that SAP CAP allows the developer to pull together the building blocks, from SAP and other parties, that are required to build an application in the specific use case. By using these building blocks, the development of a CAP application is relatively flexible; the data model can be easily adapted or extended as it grows or changes. SAP calls this the grow-as-you-go concept. SAP CAP automatically offers many features out-of-the-box, allowing the developer to have a working application running relatively quickly with common functionalities that would otherwise have taken a long time to implement. Because CAP uses a global variation of known techniques, you are not dependent on one vendor, but there are always alternatives (proprietary and open source!). This prevents vendor lock-ins.

In practice

Would you like to deploy CAP in your organization or are you curious about how CAP can be used? Then read this blog about the uses of CAP in your organization.

Opportunities for you as a developer

Does this technology seem appealing to you? Feel free to contact us. At INNOV8iON we also provide training in creating CAP applications, check out our information page on CAP training.

Stay tuned about the lastest innovations?

And stay tuned for the latest events