SAP BTP CAPM Application Development and Deployment – Part 6
In this article, we’ll develop a CAP application using the SAP Build Code – Joule available in BAS.
So, let’s start…
DEVELOPING CAP APPLICATION USING JOULE
Step 1: Create a Build Code Application
Login to your SAP Free Trial account and make sure you have subscribed to the SAP Build Code then open the SAP Build Code from the Service Instance & Subscriptions.

Before we proceed with our tutorial, we would like to give you an opportunity to join our ZAPYard’s learning community where we have more than 35 groups and more than 1850 real SAP Consultants interacting with each other daily. Only SAP topics and not BS. Else, they will be banned from the community without warning. ![]()
![]()
![]()
![]()
If you want to be part of ZAPYard’s Discussion Community, please feel free to check the below Link. We Ask, Answer, Help and Learn Together. There are more than 35 groups from different topics like Generative AI, SAP Joule, CAPM, BTP, RAP, BPT, Fiori, iRPA, CAI, CPI, PI/PO, ABAP on HANA, SAPUI5, SAP Build, SAP Adobe Forms, ChatBots, SAC etc. Join any group of your interest and interact with our Community.
Join ZAPYard’s WhatsApp Community – Ask, Answer, Propose & Defend SAP Topics
Now, let’s create a new Build Code project. Please click on the Create button.

Click on Build an Application

Select SAP Build Code

Select Full-stack Application

Enter the project details, make sure you have selected the right dev-space and then click on create.

It will take sometime to generate the application. Once ready it will looks like this:

Click the project to open in the SAP Business Application Studio.
Step 2: Generating the Data Model & Service using Joule
Now the application will look like below in the Business Application Studio (BAS).

You can see the Joule icon available in the left pane, click on that.

The screen will appear like this below, click on Open Guide

You will find the below functionalities of Generative AI where you can use prompt to generate/build application data model, data, logic, UI etc.
Now click on the Open Joule, select the CAP application Generation

Now copy the below prompt and paste under the Joule
Prompt:
/cap-gen-app Design a School and Student detail application. Namespace is StudentDetails. Define 2 data entities: School and Student. Both the entities have managed aspect derived from @sap/cds/common Each Student must have the following fields: student_id, firstName, lastName, dateOfBirth, dateOfJoining ,email, phoneNumber. for each student, field student_id is the key field. for each student, field student_id will be Integer. for each student, fields firstName, lastName, email and phoneNumber will be String. for each student, fields dateOfBirth and dateOfJoining will be Date type. for each student, fields student_id, firstName and phoneNumber will have mandatory annotation. Each student will have association to one school and association is called school and it is readonly.
Each school should have a school_id, SchoolName, Principal, SchoolStrength, Curriculum and rating. for each school, field school_id is the key field. All fields for each school should be String except school_id and SchoolStrength that will be stored as Integer. for each school, fields school_id, SchoolName, Principal and Curriculum have mandatory validation. for each school, field SchoolStrength is readonly and field rating has range of enum in A , B and C Each school will have composition of many students and composition is called students and it is readonly.


Now Joule is thinking & generating the application.

Click on Accept

You can see your storyboard is filled with the data models for school & students and the services are also created.

Step 3: Generating the App Logic using Joule
In the Storyboard, click on the School entity under Services, and select Open in Graphical Modeler.

Then select the entity and click on Add Logic.

Click on Add

Select Phase as Before and standard event as Create & Update
Then click on Open Code Editor with Application Logic.

Provide the below prompt in the Joule to generate the Logic Code for you.
Prompt:
Assign the length of students array in that school to the schoolstength field of school. If email field of student is blank then add firstname , lastname and @gmail.com and assign to email.

Accept the code generated by Joule.
Step 4: Generating the UI
Go to the Storyboard and click + button in the UI section.

Provide the application details and click on Next.

Select the Application Type as Template Based and click on Next.

Select the List Report Template. Click on Next.

Select the Data Object as below:
Main Entity: School
Navigation Entity: Students.
Click on Finish.

To preview your application, once the files have been generated, go to the upper-right corner, and click preview (Run and Debug). The preview will be as:

Click on the application.

Your application is ready. Now you can add some sample data to view in the application.
In this assignment we have generated the same CAP application we developed in the last assignment using SAP Build Code, Joule.
Now you can compare the effort required to develop a CAP application using the visual tool available in BAS versus building the same application using Joule.
Joule is really helpful for effectiveness in code reduction.”
Share your thoughts, questions, or experiences in the comments below—your feedback is always welcome and helps us craft even more valuable content for you.
Happy Learning!
𝑃𝑙𝑒𝑎𝑠𝑒 𝐺𝑖𝑣𝑒
𝐖𝐢𝐧𝐠𝐬
𝑡𝑜 𝑡ℎ𝑖𝑠 𝐅𝐑𝐄𝐄 𝐶𝑜𝑛𝑡𝑒𝑛𝑡 𝑤𝑖𝑡ℎ 𝑎 𝗥𝗲𝗣𝗢𝗦𝗧 

Please follow our LinkedIn Page, LinkedIn Group , Facebook Page, Facebook Group, Twitter & Instagram.
Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.





