Skip to Content
Technical Articles
Author's profile photo Alessandro Biagi

Extend SAP SuccessFactors on SAP BTP with CAP – Jumpstart the CAP Project

Prerequisites

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 this instructions you must have first completed the development requirements detailed in the series introduction and preparation.

1. Access your trial subaccount

Figure%201%20-%20BTP%20trial%20access

Figure 1 – BTP trial access

2. On the left-hand side expand Services and click on Instances and Subscriptions

Figure%202%20-%20Instances%20and%20Subscriptions

Figure 2 – 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%203%20-%20Open%20Business%20Application%20StudioFigure 3 – Go to Application

4. Start your previously created Dev Space by clicking on the Start Icon on the right

Figure%204%20-%20Start%20Dev%20Space

Figure 4 – Start Dev Space

5. After the Dev Space has started (status RUNNING), go into it by clicking on the Space Name

Figure%205%20-%20Go%20into%20Dev%20Space

Figure 5 – Go into Dev Space

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…

Figure%206%20-%20Find%20Command

Figure 6 – Find Command

2. In the Find Command dropdown, search for CF: Login to Cloud Foundry and select it

Figure%207%20Login%20to%20Cloud%20Foundry

Figure 7 Login to Cloud Foundry

3. Confirm the Cloud Foundry endpoint, by pressing Enter

Figure%208%20-%20Cloud%20Foundry%20endpoint

Figure 8 – Cloud Foundry endpoint

4. Enter the e-mail address you have used to create your trial account and press Enter

Figure%209%20-%20Enter%20e-mail%20address

Figure 9 – Enter e-mail address

5. Enter the password you have used to create your trial account and press Enter

Figure%2010%20-%20Enter%20password

Figure 10 – Enter password

6. Select your trial organization and press Enter

Figure%2011%20-%20Select%20organization

Figure 11 – Select organization

7. Select your Cloud Foundry dev space and press Enter

Figure%2012%20-%20Select%20Cloud%20Foundry%20Space

Figure 12 – Select Cloud Foundry space

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

Figure%2013%20-%20Confirm%20successful%20login

Figure 13 – Confirm successful login

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

Figure%2014%20-%20New%20Terminal

Figure 14 – New Terminal

2. In the terminal window at the bottom, type cd projects and press Enter. The terminal should look like this:

Figure%2015%20-%20Terminal%20at%20projects%20folder

Figure 15 – Terminal at projects folder

3. Now type cds init sfsf-projman and press Enter. The output should look like this:

Figure%2016%20-%20Project%20initialization

Figure 16 – Project initialization

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…

Figure%2017%20-%20Open%20Workspace

Figure 17 – 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

Figure%2018%20-%20Set%20Workspace

Figure 18 – Set Workspace

SAP Business Application Studio will restart and, after a few seconds, you should see the following structure at the bottom of the left-hand side pane:

Figure%2019%20-%20Project%20Structure

Figure 19 – Project Structure

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.

Conclusion

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

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.