SAP Cloud Application Programming Model Getting Started (CAP)

Aus MattWiki

This article describes how to build Cloud Application Programming Model projects (CAP projects) and according artefacts with Core Data Services (CDS).

Source: ABAP Freak Show Ep. 1 - HANA Cloud and the Business Application Studio

https://www.youtube.com/watch?v=a3WPQwmpbvI&list=PLoc6uc3ML1JR38-V46qhmGIKG07nXwO6X&index=71

For local native development see SAP HANA Local Native Development

All-in-one Quick Start: https://github.com/SAP-samples/cloud-cap-walkthroughs/blob/master/exercises-node/intro/README.md

More Repositories: https://github.com/SAP-samples/cloud-cap-samples --> Use opensap*-Branches

Installation of Prerequisites

Relevant Tools from SAP

npm i -g @sap/cds
npm i -g @sap/cds-dk

Additional 3rd Party Tools1

npm i -g hana-cli

Create CDS Project

cds init bookshop

or

cds init MyCDSProject --add hana, mta

Start Service

cds watch

This also monitors changes to the underlying files and restarts when a file has changed.

Create Persistency from CDS

cds deploy --to sqlite          # Deploys to sqlite.db
cds deploy --to sqlite:my.db    # Deploys to my.db
cds deploy --to hana            # Deploys to HDI container on HANA
                                # (Requires Cloud Foundry login)    

This also updates the package.json

In order to see the actual created SQL statements:

cds compile srv/cat-service.cds --to sql     # Creates SQL statements
cds compile srv/cat-service.cds --to hana    # Creates hdbcds or hdbtable/hdbview artefacts