Explaining Extensibility and Connectivity in CAP

After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Explain the extensibility and connectivity cappabilities in CAP

Extensibility and Connectivity Capabilities in CAP

Usage Scenario

In CAP, extensibility and connectivity are fundamental concepts that enable developers to build flexible and connected applications that can adapt to changing business needs and integrate seamlessly with various data sources and services.

Extensibility in CAP

Extensibility in CAP refers to the ability to customize and extend the data models, business logic, and user interfaces of applications to accommodate specific business requirements. CAP offers several mechanisms for achieving extensibility:

Data Model Extensibility
Developers can define data models using Core Data Services (CDS). CAP allows you to add custom entities, fields, and relationships to the data model to meet specific business needs. You can extend existing data models without altering the core structure, making it easier to adapt to changing data requirements.
Behavioral Extensibility
CAP provides service handlers and event handlers that allow you to define custom business logic. You can implement custom code that executes during various application events, such as create, read, update, and delete (CRUD) operations, validations, and data transformations.
UI Extensibility
When building user interfaces (UIs) with CAP, you can customize and extend SAP Fiori applications. This includes adding new UI components, modifying existing views, or creating custom pages to tailor the user experience to your organization's needs.
Service Extensibility
CAP allows you to create custom OData services that expose additional functionality or data to external consumers. These services can integrate with other SAP applications or external systems, facilitating data exchange and interoperability.
CAP supports localization features that enables you to adapt your application to different languages and regions, which is crucial for global deployments.

Connectivity in CAP

Connectivity in CAP is the capability to seamlessly connect and integrate with various data sources, services, and SAP internal or external systems. CAP provides multiple mechanisms for achieving connectivity:

Database Connectivity
CAP abstracts database interactions, allowing you to work with data models using Core Data Services (CDS) without being concerned about the underlying database system. CAP supports various database systems, including SAP HANA, SQLite, H2 (Java only), PostgreSQL, providing flexibility in choosing the right database for your application.
Service Connectivity
CAP applications can interact with external services and APIs using HTTP-based calls, REST, GraphQL, or other protocols. This enables integration with third-party systems and the consumption of external data. In this unit, we are going to deep dive on the integration with an external service.
Event-based Connectivity
CAP supports event-driven architecture, allowing your application to emit and listen for events. This facilitates real-time data synchronization and communication between different parts of your application or with external systems.
Message Queues and Event Brokers
CAP can integrate with message queuing systems and event brokers like SAP Enterprise Messaging or third-party solutions. This enables asynchronous communication and event-driven processing, which is essential for scalable and responsive applications.
SAP Integration
CAP can easily integrate with other SAP solutions, such as SAP Integration Suite (Cloud Integration, API Management). This allows you to create end-to-end business processes that span multiple SAP applications and services.
Security and OAuth Integration
CAP provides built-in support for authentication and authorization, including OAuth 2.0. This makes it easier to secure your application and integrate it with identity providers or SAP's authentication services.

Addition of the Consumption of an External Service to Your CAP Application

SAP Business Accelerator Hub

SAP Business Accelerator Hub is a central repository and platform provided by SAP that offers a comprehensive catalog of SAP and non-SAP APIs, including documentation, specifications, and resources to help developers discover, explore, and consume APIs effectively.

In this unit's exercise, for our risk-management application we want to add the business partner information by calling the external data source (SAP S/4HANA Cloud system) to read the risks and mitigations information alongside the business partners. The application helps to reduce risks associated with business partners using a remote API Call to SAP S/4HANA Cloud. In order to get the data for the business partner, you will need to connect the service to the Sandbox environment of the SAP Business Accelerator Hub (deep dive in the exercise).

To communicate to remote services, CAP needs to know their definitions. These definitions are usually made available by the service provider. As they aren't defined within your application but imported from outside, they're called external service APIs in CAP. Currently, EDMX files for OData V2 and V4 are supported.

The steps for using the Business Partner external API in the risk management project are as follows:

  1. Connect your app with the Business Partner API Sandbox Environment of the SAP API Business Hub. For this, you can configure an application defined destination in Node.js by just adding this configuration on the package.json file.
    Code snippet
    "cds": {
        "requires": {
            "kind": "odata",
            "model": "srv/external/API_BUSINESS_PARTNER",
            "credentials": {
              "url": "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/"
  2. Consume the External Service in your UI application.
  3. Add the Business Partner Field to the UI. ​

In order to manage the connectivity to external systems or services you can choose to use destinations: SAP BTP destination of application defined destinations (example above). They provide a way to define and configure the connection details to these external systems, making it easier to handle various aspects of integration, such as authentication, endpoint URLs and more, by abstracting the underlying connection information.

In case of using SAP BTP destination, the application will need to be actually deployed to BTP. This is because we require instances of SAP’s Destination Service and Connectivity Service (in case of an premise external service), which can only be created and bound to an application on BTP. The Connectivity service provides a connectivity proxy that you can use to access on-premise resources. Using the Destination service, you can retrieve and store the technical information about the target resource (destination) that you need to connect your application to a remote service or system. You can use both services together as well as separately, depending on the needs of your specific scenario.

If the external system is on-premise, the Cloud Connector will need to be configured in order to use the on-premise resources.


You now have a high-level understanding of the extensibility and connectivity possibilities using CAP framework.

Further reading

For more information, consult the following:

Log in to track your progress & complete quizzes