Assignment 4
Developing CAP App using Joule in Business
Application Studio
How To Develop CAP App with Joule in BAS
In this assignment, we’ll develop a CAP application using the SAP Build
Code – Joule available in BAS.🚀
We will compare the effort required to develop a CAP Application using the Visual
Tool available in BAS (done in last assignment) versus building the same Application
using SAP’s AI Assistant “Joule”.
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |1
How To Develop CAP App with Joule in BAS
Now, let’s create a new Build Code project. Please click on the Create button.
Click on Build an Application
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |2
How To Develop CAP App with Joule in BAS
Select SAP Build Code
Select Full-Stack Application
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |3
How To Develop CAP App with Joule in BAS
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:
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |4
How To Develop CAP App with Joule in BAS
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |5
How To Develop CAP App with Joule in BAS
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |6
How To Develop CAP App with Joule in BAS
Now click on the Open Joule under the Data Model and Service Creation
Now copy the below prompt and paste under the Joule
Prompt
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 read only.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |7
How To Develop CAP App with Joule in BAS
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |8
How To Develop CAP App with Joule in BAS
Click on Accept
You can see your storyboard is filled with the data models for school & students
and the services are also created.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E |9
How To Develop CAP App with Joule in BAS
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 10
How To Develop CAP App with Joule in BAS
Click on Add
Select Phase as Before and standard event as Create & Update
Then click on Open Code Editor with Application Logic.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 11
How To Develop CAP App with Joule in BAS
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 12
How To Develop CAP App with Joule in BAS
Provide the application details and click on Next.
Select the Application Type as Template Based and click on Next.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 13
How To Develop CAP App with Joule in BAS
Select the List Report Template. Click on Next.
Select the Data Object as below:
Main Entity: School
Navigation Entity: Students.
Click on Finish.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 14
How To Develop CAP App with Joule in BAS
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.
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 15
How To Develop CAP App with Joule in BAS
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 indeed is helpful for effectiveness in code reduction.” 🚀
Happy learning!
Note: This assignment is part of our Online Training - SAP Generative
AI, SAP Joule and SAP Build Code
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 16
How To Develop CAP App with Joule in BAS
SAP Consultants, stay ahead of the Curve.
Check our exclusive Hands-On Instructor Led Online
SAP Training Courses!
https://www.zapcademy.com/
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 17
How To Develop CAP App with Joule in BAS
Found this Useful? Awesome!
You may Enjoy these too..
Follow us on LinkedIn
https://www.linkedin.com/company/zapyard/
Subscribe to YouTube Channel
https://www.youtube.com/zapyard?sub_confirmation=1
Follow us on Facebook
https://www.facebook.com/zapyard
Connect with us on WhatsApp
+1-251-727-9273
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 18
How To Develop CAP App with Joule in BAS
SHARING IS CARING
Give WINGS to this
FREE Content
with a REPOST
ASSIGNMENT 4 ©https://zapyard.com/ P A G E | 19