Technical Articles
SAP Business Technology Platform Extension Generators | Hands-on Video Tutorials
Hands-On Video Tutorials
What You Will Learn
The SAP Business Technology Platform – Extension Generators playlist on the SAP HANA Academy YouTube channel contains 14 videos running for about 150 minutes (time of writing, new videos may be added in the future).
What you will learn
- How to install the SAP HANA Academy CAP generator
- How to configure the generator to create BTP business application extensions
- How to test the app locally
- How to build and deploy the app to the BTP Cloud Foundry environment
- How to generate code for OData v2 (v4 is default)
- How to configure application logging for Kibana
- How to debug the app
- How to generate authentication (using XSUAA)
- How to generate authorization
- How to generate role attributes
- How to generate native SAP HANA Cloud artifacts (calculation view)
- How to generate OData access to classical database schema
- How to generate OData existing HDI container access
- How to re-generate design time artifacts after object changes
- How to configure additional backend services with examples of both CAP-based and regular Node.js of additional services included
- How to interact with the SAP Analytics Cloud Tenant API using CAP or MTA
Business Value for SAP Partners
For insights and an overview of the business value for SAP partners, listen to the introduction of the SAP HANA Academy extension generators for SAP Business Technology Platform Extension Suite by Joe King.
Playlist
To bookmark or directly access the playlist, go to
Ingredients
To follow along, you’ll need a (free) SAP BTP trial account. If you are new to the SAP SAP Business Technology Platform, consider watching the onboaring series first.
Although not required, for persistence most of the extension generator apps leverage SAP HANA Cloud. If you are new to this topic, consider watching this tutorial first.
Github Code Sample
For the code samples used in the OData Classical Schema tutorial, go to
About BTP Extension Generators
The SAP BTP extension generator uses Yeoman to scaffold a business application. This enables us to present a simple yet fully functional business application to jumpstart your app development. Whether you want to create an extension for SAP S/4HANA Cloud, SAP SuccessFactors, or build an application powered by SAP HANA Cloud, you can easily scaffold the app using the generator and adapt the app to your development.
Yeoman generators are extensively used (as extensions) in SAP Business Application Studio and you can easliy add your own. However, the IDE and generator have no dependencies. Yeoman works just a well on the command line (using the yo command) or other IDE’s like Microsoft Visual Studio Code, etc.
For more information about Yeoman generators, visit
Cloud Application Programming
Tutorial
In the first video tutorial, Philip Mugglestone shows how to jumpstart a SAP Extension Suite application based on the CAP framework in the Cloud Foundry environment.
Markers
0:00 – Introduction
0:20 – About SAP Cloud Application Programming Model (CAP)
1:00 – Demo SAP Business Technology Platform (BTP) trial environment
1:30 – SAP Business Application Studio
2:00 – Install generator
3:00 – Run template wizard
5:45 – Code review
7:00 – Build for local development
10:00 – Build and deploy MTA project
12:00 – About extension generators
CAP – Core Functionality
Tutorial
In this video tutorial, Philip Mugglestone walks through the core functionality of the example SAP Extension Suite application based on the CAP framework and created via the jumpstart generator.
Markers
0:00 – Introduction
0:30 – Run template wizard
1:00 – View output
1:25 – Code review
1:35 – Data model CDS
2:30 – Business logic in server module
4:00 – API
6:00 – User interface and app router
7:20 – Multi-target application with services and modules
10:40 – Build for local development with demo
12:55 – Customising extensions
CAP – OData v2
Tutorial
In this video tutorial, Philip Mugglestone walks through how to enable OData v2 services in addition to the default of OData v4.
Markers
0:00 – Introduction
0:30 – Run generator
0:55 – Code review: proxy in package.json and server.js
3:00 – Differences with actions and functions
4:10 – Run app locally
CAP – Application Logging
Tutorial
In this video tutorial, Philip Mugglestone walks through how to enable Application Logging.
Markers
0:00 – Introduction
0:30 – Generate app and enable application logging
1:00 – Code review: app-logging in mta.yaml
2:15 – Nodejs logging support in package.json
3:00 – Logging in catalog-service.js
4:00 – Build and deploy MTA project
4:30 – Run application
4:50 – Command cf logs
5:15 – BTP application logging service
6:00 – Kibana dashboard
CAP – Debug
Tutorial
In this video tutorial, Philip Mugglestone walks through how to work with debug logging for both local development and testing as well as applications already deployed to BTP.
Markers
0:00 – Introduction
0:30 – Debug module in package.json
0:55 – Code sample
2:40 – Run app locally
3:20 – Set debug command
4:30 – Debugging deployed apps
5:15 – Set environment variable and restage app
CAP – Security Authentication
Tutorial
In this video tutorial, Philip Mugglestone walks through how to configure authentication for both local development and testing as well as applications deployed to BTP.
Markers
0:00 – Introduction
0:20 – Generate app and enable authentication
0:40 – Code review
2:10 – Server module
3:10 – XSUAA service
4:05 – App router
4:45 – Run app locally
5:50 – Build and deploy MTA project
6:15 – Access server module (back-end)
6:50 – Access app router (front-end)
7:20 – Identity provider
CAP – Security Authorization
Tutorial
In this video tutorial, Philip Mugglestone walks through how to configure authorization for both local development and testing as well as applications deployed to BTP.
Markers
0:00 – Introduction
0:25 – Generate app and enable authorization
0:40 – Code review
1:30 – Configuration security.json with scopes and role collections
2:30 – CDS requires and restrict
3:45 – Run app locally
4:55 – Test with test.http
6:00 – App router configuration xs-app.json
6:30 – Build and deploy MTA project
6:50 – Assign role collection
7:30 – Run app
CAP – Security Attributes
Tutorial
In this video tutorial, Philip Mugglestone walks through how to configure role attributes for both local development and testing as well as applications deployed to BTP.
Markers
0:00 – Introduction
0:25 – Generate app with role attributes
1:00 – Code review: attributes and attribute-references in xs-security.json
1:50 – Server module
3:20 – Mock users and test.http
4:00 – Run app locally
5:20 – Build and deploy MTA project
5:40 – Configure role
7:20 – Assign role collection
8:00 – Run app
CAP – Native HANA (1)
Tutorial
In this video tutorial, Philip Mugglestone walks through how to configure native SAP HANA artifacts with SAP Cloud Application Programming Model projects. Native HANA artifacts include stored procedures and calculation views.
In Part 1 Philip shows how to use the generator to scaffold an example application which is then built and deployed to the Cloud Foundry runtime and tested.
Markers
0:00 – Introduction
0:30 – Business Application Studio space with full stack and calculation view editor and HANA tools
1:00 – Install SAP Partner Engineering BAS extension pack
1:50 – Install HANA Academy yeoman generator
2:10 – Generate app with SAP HANA Cloud artifacts
2:45 – Code review database and server module and MTA configuration files
7:30 – CAP documentation about Native SAP HANA
7:50 – Build and deploy MTA project
8:35 – Run app
CAP – Native HANA (2)
Tutorial
In this video tutorial, Philip Mugglestone walks through how to configure native SAP HANA artifacts with SAP Cloud Application Programming Model projects. Native HANA artifacts include stored procedures and calculation views.
In Part 2 Philip shows how to create new antive SAP HANA artifacts and test them locally before building and deploying the full application to the Cloud Foundry runtime.
Markers
0:00 – Introduction
2:10 – About gen folder
2:45 – SAP HANA tools
3:20 – Bind to HDI container and open in SAP HANA database explorer
4:30 – Create new database artifact and edit in Calculation View editor
6:35 – Deploy
7:30 – Move from gen/db/src to db/src
8:00 – Configuration file .env
8:20 – Data model
9:10 – Run app locally
10:20 – Install Cloud Foundry .env plugin
12:00 – Build and deploy MTA project
Commands
Commands used
cds build --production
cf de app-srv
CDS_ENV=production cds watch
CAP – OData Classical Schema
Tutorial
In this video tutorial, Philip Mugglestone walks through how to enable OData on all tables and views of an existing SAP HANA Cloud classical schema. Philip also shows how to access the OData service via a UI and programmatically via Postman.
Markers
0:00 – Introduction
0:40 – Prerequisites
1:20 – Allowed connections
2:00 – Open SQL Console and execute sample code [travel_OData.sql]
3:00 – Connect BAS to your BTP Cloud Foundry org and space (hack)
3:40 – Generate app with existing SAP HANA Cloud schema
5:50 – View Output
6:45 – View apps and services in SAP BTP cockpit
7:30 – Code review MTA for mta.yaml and xs-security.json
9:00 – db module
11:00 – srv module
12:00 – app module
12:30 – Build and deploy MTA project
13:00 – Assign role collection
14:00 – Run app
15:30 – Interact with OData service using Postman
16:45 – Get OAuth 2.0 token
18:00 – GET request
18:30 – POST request
CAP – Refresh OData Classical Schema
Tutorial
In this video tutorial, Philip Mugglestone walks through how to refresh a previously created OData service on all tables and views of an existing SAP HANA Cloud classical schema.
Tutorial
0:00 – Introduction
3:15 – Run application subgenerator to update project files
6:45 – Build and deploy
CAP – OData Existing HDI Container Access
Tutorial
n this video tutorial, Philip Mugglestone walks through how to enable OData on all tables and views of an existing SAP HANA Cloud HDI container. Firstly Philip builds and deploys an example existing HDI container including hdbrole artifacts. Then he builds and deploys an application that accesses the existing HDI container via hdbgrants and hdbsynonym artIfacts.
Markers
0:00 – Introduction
2:00 – Deploy schema and service for HDI container
7:10 – Run SAP HANA Academy CAP generator
12:30 – Deploy app
14:15 – Add role collection
14:45 – Run app
17:00 – Undeploy app
17:30 – Undeploy HDI container
Download
Sample code
CAP – Refresh OData Existing HDI Container
Tutorial
In this video tutorial, Philip Mugglestone walks through how to refresh a previously created OData service on all tables and views of an existing SAP HANA Cloud HDI container.
Markers
0:00 – Introduction
2:00 – Change artefacts (design time)
3:45 – Update runtime
5:00 – Run application subgenerator to update project files
7:15 – Build and deploy
CAP – Additional Services
Tutorial
In this video tutorial, Philip Mugglestone shows how to configure additional backend services as part of a CAP project for performance, functional or scalability reasons. Both CAP-based and regular Node.js examples of additional services are configured.
Markers
0:00 – Introduction
0:50 – Start CAP generator
1:40 – Source code review
8:55 – Build and deploy
10:45 – Recap
CAP – SAP Analytics Cloud Tenant API
Tutorial
How to configure access to the SAP Analytics Cloud Tenant API as part of a CAP project deployed to SAP BTP. Single sign-on for business users via OAuth2 SAML Bearer Assertion is covered as well as technical user authentication via OAuth2 Client Credentials.
Markers
0:00 – Introduction
0:30 – About the SAP Analytics Cloud REST API
2:20 – Add new OAuth Client in SAP Analytics Cloud
3:50 – Add Trusted Identity Provider
5:20 – HANA Academy CAP Generator for SAP Business Application Studio
6:40 – Code review
9:30 – Build and deploy
9:50 – Add role collections using SAP BTP Cockpit
10:20 – Set Oauth Client ID and secret for the destination
11:40 – View results
12:25 – Technical user
References
For the references, see
MTA – SAP Analytics Cloud Tenant API
Tutorial
How to configure access to the SAP Analytics Cloud Tenant API as part of a multi-target application (MTA) project deployed to SAP BTP. Single sign-on for business users via OAuth2 SAML Bearer Assertion is covered as well as technical user authentication via OAuth2 Client Credentials.
Markers
0:00 – Introduction
0:30 – About the SAP Analytics Cloud REST API
2:25 – Add new OAuth Client in SAP Analytics Cloud
3:50 – Add Trusted Identity Provider
5:20 – HANA Academy MTA Generator for SAP Business Application Studio
7:00 – Code review
9:15 – Build and deploy
9:35 – Set Oauth Client ID and secret for the destination
11:00 – Add role collections using SAP BTP Cockpit
11:20 – View results
12:15 – Technical user
References
For the references, see
Share and Connect
Questions? Please post as comment.
Useful? Give us a like and share on social media.
Thanks!
If you would like to receive updates, connect with me on
- LinkedIn > linkedin.com/in/dvankempen
- Twitter > @dvankempen
For the author page of SAP PRESS, visit
Over the years, for the SAP HANA Academy, SAP’s Partner Innovation Lab, and à titre personnel, I have written a little over 300 posts here for the SAP Community. Some articles only reached a few readers. Others attracted quite a few more.For your reading pleasure and convenience, here is a curated list of posts which somehow managed to pass the 10k-view mile stone and, as sign of current interest, still tickle the counters each month. |
Amazing content Denys van Kempen,!
I am positively sure BTP is a game changer in the EIPaas industry. A true extensibility and integration enabler.
Cheers,
Luis
Great content! Thank you Denys!
Could you please explain (in writing or in a video 🙂 ) how could we use the generator in 'OData Classical Schema' in our own projects? More specifically, could we get the source code of the generator (open source)? Could you please explain how to modify and install this in our own SAP instance (for example on premise cloud)? Etc.
Thank you very much!
Hi Zoltan,
Et voilà
The templates are published to
The GitHug repo contains a README with instructions
Thanks a lot Denys!
So, if we would want to change the generator... Would you know by any chance if it is possible to add a generator locally without publishing it on yeoman (and npmjs.org repository)? If this would be possible, then how would we need to install it from the source in SAP Business Application Studio? We could then probably develop the generator in SAP Business Application Studio!? Thank you!
Hi Zoltan,
Sorry for the delay and thanks for asking!
You should be able to git clone (or download a zip) of the generator from GitHub then run
followed by
on the cmd line from the main folder with the package.json.
Assuming Yeoman is installed the
command should find your local version.
You would likely need to uninstall any previously installed saphanaacademy generators beforehand.
Thanks,
Philip
Hi Denys,
Wonderful blog, but it remains me one doubt after watching the "OData existing HDI container access", I'm trying to consume the "app-srv" but an authorization occurs on "/travel-db /$metadata", i deployed again but on this time enabling the Consume the External API and Odata V2 on the "Hana Academy CAP" but occurs the same error, what could i possible doing wrong ?
Best regards,
Tiago Benjamim
Hi Tiago Benjamim,
Difficult to say without more details - the full URL being called, how called (interactively in browser or programmatically) and the exact authorization error (code & message).
I assume you responded with the default answer (true) to the prompts "Would you like authentication?" and "Would you like authorization?" as shown in the video tutorial?
In that case I recommend to double-check you have assigned the relevant role collections to the user and are calling the travel-db endpoint via the approuter module (app) for interactive (browser usage) and not the back end server module (app-srv). The steps are shown in the video tutorial from 14:15.
The app-srv module can be called directly for non-interactive (programmatic) access in which case you'd also need to obtain a suitable access token (JWT) and explicitly pass this in the authorization header.
More details in the accompanying authentication and authorization video tutorials.
Thanks,
Philip
Hi Philip,
Sorry for not being more precise, was tired.
I'm doing all the stuffs again right now using different approaches, the last shoot i enable the authentication, authorization and Odata v2, add the Admin and Viewer roles on security tab to my Sap user and also generated the Oauth v2 token on Postman, but the 401 - Unauthorization error was retrieved when i tried to reach the back-end server (app-srv).
Do i need to use the saphanaacademy - Odata to exposed the (app-srv) or saphanaacademy-cap is enough ?
Thanks for your response.
Tiago
Hi Tiago,
saphanaacademy-cap generator is recommended as it supersedes saphanaacademy-odata and also provides many additional capabilities.
So you're doing non-interactive programmatic access.
Sounds like there's an issue with the access token. Are you sure to have included "Bearer " before specifying the obtained JWT in the Authorization header?
In order to get a valid JWT (response.access_token) you need to POST to https://<subaccount>.authentication.<region>.hana.ondemand.com/oauth/token?grant_type=password using basic auth with the clientid & clientsecret of a service key for your xsuaa service instance and also a form (x-www-form-urlencoded) in the body with username & password of the business user for which the relevant role collection(s) have been assigned.
This is covered in the "OData Classical Schema" video tutorial from 15:30
Thanks,
Philip
Is any of this applicable for the NEO BTP environment?
Hi Daniel,
Whilst this content cannot be deployed to Neo subaccounts, it may be useful when migrating applications previously deployed in Neo to Multi-Environment subaccounts. For example migrating an application based on SAP HANA XS Classic to SAP HANA Cloud .
Thanks,
Philip