ERPClimb logoERPClimb

CAP · Intermediate · Configuration

How to create and run an SAP CAP Node.js project

Establish a runnable CAP project with a data model and service before adding cloud deployment and authentication.

APPLICABILITY
SAP BTP / local development workspace
TOOLS / TRANSACTIONS
BAS · Node.js · CDS

Your project assignment

Create a small read-only book catalog using CAP Node.js and test it locally before configuring production services.

Where to start: URLs and transactions

BAS
Open the running CAP-capable dev space
CAP documentation
https://cap.cloud.sap/docs/

Prerequisites

  • Running full-stack CAP-capable dev space.
  • Supported Node.js runtime and CAP tooling.
  • Approved workspace and repository.

Configuration workflow

CAP model to local service

All steps visible. Play or advance one stage at a time.

CAP model to local serviceCDS project: cds init and npm install → db/schema.cds: Define Books entity → srv/catalog.cds: Expose read-only projection → cds watch: Test metadata and read endpoint1CDS projectcds init and npm install2db/schema.cdsDefine Books entity3srv/catalog.cdsExpose read-only projection4cds watchTest metadata and read endpoint
Local service verification comes before a production deployment. ERPClimb original instructional diagram · not a live SAP screenshot.

Hands-on implementation — step by step

Follow the screen navigation, replace example values with approved project values, and mark each step after checking its result. The screens below are original teaching aids, not live SAP screenshots. Progress is local to this visit.

0/4 completed
  1. 1

    BAS terminal

    Check Node and CDS CLI versions. If unavailable, follow the current CAP development setup in the official guide.

    BAS terminalERPClimb · illustrative screen
    Commands
    node --version; cds --version
    Workspace
    Approved development folder

    Expected result: Tools are available at compatible versions.

    Why this matters: Version mismatches create avoidable initialization failures.

  2. 2

    Terminal → initialize

    Run cds init erpclimb-demo; cd erpclimb-demo; npm install. If using the guided wizard, select an equivalent Node.js project.

    Terminal → initializeERPClimb · illustrative screen
    Project
    erpclimb-demo
    Commands
    cds init erpclimb-demo; cd erpclimb-demo; npm install

    Expected result: Project structure and package.json exist.

    Why this matters: CAP separates persistence model and service definitions.

  3. 3

    db/schema.cds and srv/catalog.cds

    Create a simple entity and a read-only service projection.

    db/schema.cds and srv/catalog.cdsERPClimb · illustrative screen
    db/schema.cds
    namespace demo; entity Books { key ID : Integer; title : String; }
    srv/catalog.cds
    using { demo as db } from '../db/schema'; service CatalogService { @readonly entity Books as projection on db.Books; }

    Expected result: CDS model resolves without compilation errors.

    Why this matters: Projection exposes a deliberately limited service interface.

  4. 4

    Terminal → run

    Ensure local persistence dependencies are configured if required by the generated project; run cds watch. Follow the actual service link printed in terminal and append /$metadata.

    Terminal → runERPClimb · illustrative screen
    Command
    cds watch
    Request
    Actual service endpoint + /$metadata

    Expected result: Metadata contains Books; GET Books works when local persistence is configured.

    Why this matters: Use the server-generated URL rather than assuming a fixed route.

Project acceptance checklist

Use this checklist to prepare evidence for your project lead.

0 of 3 checks marked. This does not certify the SAP configuration.

Validate your configuration

  • CAP server starts without model errors.
  • Local metadata and a sample entity read return expected results.

Common errors and what to check

  • Version mismatch between Node and CAP packages.

  • A local mock database or authentication setting is not a production deployment configuration.

More in the SAP Library

Need help with a configuration error? Open ERPClimb Copilot.

Technical references & further reading

Official documentation for technical verification, release compatibility and further study.