Extend SAP SuccessFactors on SAP BTP with CAP – Jumpstart the CAP Project
To follow-up with this blog post you must have read and completed the following previous blog posts in this series:
Access SAP Business Application Studio
We are going to start the journey by accessing the selected IDE for development (in this case, SAP Business Application Studio). To proceed with these instructions you must have first completed the development requirements detailed in the series introduction and preparation.
1. Access your trial subaccount
2. On the left-hand side expand Services and click on Instances and Subscriptions
3. On the right, under Subscriptions, click on the small icon next to the SAP Business Application Studio subscription to go to the application
Figure 3 – Go to Application
4. Start your previously created Dev Space by clicking on the Start Icon on the right
5. After the Dev Space has started (status RUNNING), go into it by clicking on the Space Name
Login to Cloud Foundry
Before starting the development, you need to make sure to be properly logged in to the Cloud Foundry environment on your BTP subaccount.
1. From the top menu, click on View and select Find Command…
2. In the Find Command dropdown, search for CF: Login to Cloud Foundry and select it
3. Confirm the Cloud Foundry endpoint, by pressing Enter
4. Enter the e-mail address you have used to create your trial account and press Enter
5. Enter the password you have used to create your trial account and press Enter
6. Select your trial organization and press Enter
7. Select your Cloud Foundry dev space and press Enter
8. Click on the small notifications icon in the bottom right corner to view the login notifications to make sure the login has been successful
Create the CAP Project
Now it’s time to create the CAP Project and understand it’s structure.
1. From the top menu, click on Terminal and select New Terminal
2. In the terminal window at the bottom, type cd projects and press Enter. The terminal should look like this:
3. Now type cds init sfsf-projman and press Enter. The output should look like this:
Notice that sfsf-projman is the project and application name and also the project folder name. Now, let’s open the project as a workspace.
4. From the top menu, click on File and select Open Workspace…
5. In the dialog, select the sfsf-projman folder under projects and the VS Code Workspace (*.code-workspace) from the Format dropdown, then click Open
You can see that, under the project folder, cds has created three folders (app, db and srv) and three files (cdsrc.json, package.json and README.md). Let’s quickly understand the purpose of each one of them:
- app – is the folder where we are going to create the HTML5 application for the UI (in our case, it’s going to be an SAP Fiori Elements HTML5 application)
- db – is the folder into which we will create the files to define the application data model (CDS data model) and also put some initial data in CSV format to test the application (under a subfolder named data)
- srv – is the folder where we place the files of our service definition and business logic.
- cdsrc.json – this file is created to specify settings to be used commonly across several projects or to alternatively hold static project settings additionally to the package.json. You can find more information about the usage of this file here.
- package.json – this file holds project specific settings following the common node.js standard.
- README.md – is used for project documentation.
After having gone through the steps of this blog post you should have successfully initialized your CAP Project and are ready to start the application development. The next step is to Import the two SuccessFactors OData services definitions into your CAP Project.
NOTE: the instructions in this blog post apply exactly the same to any CAP Project (not only SAP SuccessFactors extensions), so you can rely on them for any future development.
Please, do not hesitate to submit your questions in SAP Community through the Q&A tag link: https://answers.sap.com/index.html
Next blog post in this series