Setting the Scope

Objective

After completing this lesson, you will be able to describe the focus of the learning journey

Topics To Be Covered

In this introductory learning journey, we will focus on specific aspects of CAP, rather than covering all aspects. For the sake of clarity, however, we will focus on the following topics:

  • Node.js as the runtime environment
  • Service SDKs
  • SAP Business Application Studio as the development tool
  • Core Data Services (CDS)
  • SQLite as the database

Let's go into details of each topic.

Choose a Runtime Environment

CAP supports Node.js and Java as runtimes. Both environments offer unique advantages and cater to different development preferences and scenarios. The choice between them should be based on the project requirements, team expertise, and the specific use case. Since Node.js is more widely used, we will discuss this runtime in this learning journey.

Information about the CAP Service SDK for Java can be found in the CAP documentation.

Choose a Development Tool

Both Visual Studio Code (VS Code) and SAP Business Application Studio (BAS) can be used for CAP application development.

VS Code is a lightweight, extensible, and general-purpose code editor developed by Microsoft, while BAS is a development environment from SAP tailored specifically for developing applications on the SAP Business Technology Platform (BTP).

VS Code runs locally on the developer's machine and must be extended with various plugins to meet CAP development requirements. Developers must manually manage and update certain extensions and tools to enable CAP development capabilities. However, if developers want to develop CAP applications using VS Code, they must not only ensure that they have VS Code installed and set up appropriately. They also need to make sure that they have other things needed for development installed locally, such as Node.js, Git, SQLite, Java, Maven, and CAP's CDS development kit.

In contrast, BAS is a cloud-based development environment that runs on BTP. It provides pre-configured development environments (called dev spaces) tailored to specific SAP scenarios, including CAP. BAS provides out-of-the-box integrations with SAP tools and services to ensure seamless development of SAP solutions. This includes tools for modeling, testing and deploying CAP applications. As a managed cloud service, updates and enhancements to BAS are applied by SAP, ensuring that the environment is always up-to-date.

The choice between the two development environments often depends on individual or organizational preferences, familiarity with the tools, and specific project requirements. In this learning journey, we will use BAS because it can be used straight away for CAP development without any additional installations or configurations. To set up a local environment based on VS Code for CAP development, see the CAP documentation.

Employ Core Data Services (CDS)

Within CAP, CDS acts as the backbone for defining, extending, and interacting with data and services. It is therefore also an essential part of this learning journey.

CDS is primarily a data modeling language. It allows developers to define data structures, their relationships, and other relevant semantics to provide a clear representation of the underlying data model.

In addition to just defining data models, CDS also allows for the definition of services. This means that developers can specify directly in CDS definitions how data is accessed and processed by services.

Based on CDS definitions, CAP can automatically generate parts of the application, including database schemas, OData services and even parts of the application logic. This significantly speeds up the development process.

Choose a Database

The situation is similar for the database. In production, SAP HANA Cloud is recommended as database. However, the lightweight in-memory database SQLite can be choosen for testing during development.

This means that you can easily develop your CAP application with a local database and mock-ups.

At some point, however, you will want to test with real cloud services. To that end, you can always deploy your application to the cloud. But CAP also supports hybrid testing options, which means you can stay in your local development environment and avoid the long turnaround times of cloud deployment, and you can selectively decide which services you want to use from the cloud.

CAP provides configuration profiles for this approach, such as development, production, and hybrid, to provide settings for different environments. You can switch between local mock configuration and cloud service configuration by simply using the appropriate configuration profile - without any changes to models or code.

In this learning journey, we will limit ourselves to working with the local database SQLite and with mockups for platform services, so as not to go beyond the scope of the training. For information on hybrid testing, see the CAP documentation. There you will also find information on how to prepare a CAP application for production and deploy it in different runtime environments (such as SAP BTP Cloud Foundry or Kyma Runtime of SAP BTP).

Other Aspects of CAP

CAP Support for SAP Fiori Elements

CAP provides out-of-the-box support for user interfaces based on SAP Fiori elements. SAP Fiori elements is a collection of common application patterns and UI elements based on the SAPUI5 framework. The main goal of SAP Fiori elements is to provide a consistent and optimized user experience across all SAP applications and to speed up the development process by using predefined templates for the most common application patterns. SAP Fiori elements adhere to the SAP Fiori design guidelines.

The UIs are generated at runtime based on metadata annotations provided by the developer. There is no need for additional JavaScript coding.

How to define such interfaces in a CAP project is beyond the scope of this learning journey and therefore not discussed further here. If you are interested in how to add one or more SAP Fiori elements applications to a CAP project, how to add SAP Fiori elements annotations to the respective service definitions and more, see the CAP documentation.

CAP Support for Project Generation and Simplified Development

CAP allows you to jumpstart projects within seconds. For this purpose, it provides mocks for many platform features, enabling fast dev-test-run cycles with minimal development environment complexity.

In production, for example, a corresponding service of the platform is used for user authentication and authorization. However, during development, mocked authentication can be employed. Similarly, CAP simplifies integration scenarios by simply importing an API from, for example, an SAP S/4HANA backend and running mocks for it locally.

Now that we have gained a foundational understanding of the SAP CAP framework, let's dive into creating a new CAP project using SAP BAS.

Log in to track your progress & complete quizzes