Extend SAP SuccessFactors on SAP BTP with the SAP Cloud Application Programming Model (CAP) – Blog Posts Series


Introduction

Let’s start by defining what can be considered a solution extension: extensions are applications which focus on supporting a very specific business scenario that is, somehow, not supported by the core solution (i.e. SAP S/4HANA, SAP SuccessFactors, SAP CX, etc.). In other words, extensions exist to fill functional gaps of some enterprise software.

They are called extensions exactly because they “extend” the functionality of a bigger enterprise solution and they’re built “on top” of it being “decoupled” from its core functionality: that’s how we free up the path to fast paced innovation in the core solution.

In the on-prem age, we used to call them “software customizations”, developing “inside” the core  solution as additional functionality. Such approach led to slow and cost ineffective software upgrades as there was a huge effort to make sure those “customizations” wouldn’t break when newer software versions came up (thus considerably slowing the pace of innovation).

In this blog series we will walk you through the path to build an end-to-end solution extension for SAP SuccessFactors.leveraging the SAP Cloud Application Programming Model (in short, CAP), SAP Fiori Elements and SAP Business Technology Platform.

Business Scenario

We are going to build a simple project management application on top of SAP SuccessFactors following these business rules:

  1. Each project is composed by members (team) and activities;
  2. The project team (members) is made of SuccessFactors employees;
  3. Each project member has an specific role in the project;
  4. Each project activity is assigned to a specific project member;
  5. Projects and activities have one status each (i.e. not started, in progress, overdue, completed etc.);
  6. And last, but not least, whenever a team member is assigned to a project, a special assignment is registered to the employee background to signal that such employee has participated in the project, acting in a specific role, as part of the employee’s professional experience.

Application Architecture

Here’s a diagram representing the overall architecture for the application:

Figure%201%20-%20Application%20Architecture

Figure 1 – Application Architecture

The solution is a standalone application that will read the basic employee (SF user) information from SuccessFactors using the User entity from the PLTUserManagement (platform user management) OData service and write the project assignments to the employees’ background using the Background_SpecialAssign entity from the ECEmployeeProfile (employee central employee profile) OData service, through a single destination configured in SAP BTP, Cloud Foundry.

The application data model will be stored in a SAP HANA Cloud database. So, as you can see, it’s a very simple architecture.

Please, note that the application can be deployed either on Cloud Foundry or on Kyma. We will initially deploy on Cloud Foundry and later, when we have everything working fine on that environment, we will add instructions to deploy on Kyma in a separate blog post.

Data Model

Here’s a diagram representing the data model for the application for the application:

Figure%202%20-%20Data%20Mdel%20Diagram

Figure 2 – Data Model Diagram

An extension data model cannot have associations (or compositions) directly linked to entities in the extended solution as they’re not persisted in the same database.

Therefore, to assign the employees as members of projects’ teams we need to create a kind of “bridge” between the actual entity in SuccessFactors (in this case User) and the application data model by defining an “auxiliary entity” (in this case Employee) to strictly hold the User data from SuccessFactors and associate it to the other entities in the model, serving as a kind of “cache” of employees participating in projects (please, note that it’s not a “replication” of the User entity, as it only stores the employees who are assigned as members in existing projects).

We have chosen to use the User entity from SuccessFactors because it’s completely stable, meaning that it cannot be deleted but only marked as “inactive”, otherwise we could fall into an integrity issue.

In the same way, there’s no direct association between the projects and the background assignments, but we add it to the diagram just to have a complete conceptual representation of the model.

Requirements for Development 

This is the list of requirements to develop the solution:

  1. First of all, you’ll need an SAP BTP Trial Account which you can get following this tutorial;
  2. We will use SAP Business Application Studio as the development environment, so you can set it up in your SAP BTP trial following this tutorial;
  3. In your Business Application Studio, create a dev space for Full-Stack development.
  4. As demonstrated in the architecture, we will use SAP HANA Cloud for the data model persistence, so you’ll need to create a SAP HANA Cloud database instance following this tutorial (please, be aware that everything in trial accounts shut down overnight – applications, databases etc., so make sure you start your database instance before deploying your solution);
  5. To use the HTML5 applications repository and add the application to the launchpad we will need to setup the SAP Launchpad Service. You can do it following this tutorial.
  6. And last, but not least, you’ll need access to a SAP SuccessFactors development tenant with admin credentials (unfortunately there’s no trial for that one, so make sure you’re granted such access by other means).

Initial Preparation

After having complied with all requirements in the list, let’s create the destination to the SAP SuccessFactors API tenant before we actually start developing the application. To do so, just follow these simple steps:

1. Access your trial subaccount

Figure%203%20-%20BTP%20trial%20access

Figure 3 – SAP BTP trial access

2. On the left-hand side, expand the Connectivity section and click on Destinations

Figure%204%20-%20Access%20Destinations

Figure 4 – Access Destinations

3. On the right, click on New Destination

Figure%205%20-%20New%20Destination

Figure 5 – New Destination

4. Fill-up the destination information according to the screenshot and instructions below

Figure%206%20-%20Destination%20Information

Figure 6 – Destination Information

a. URL of your SAP SuccessFactors API tenant. Usually it follow the format: https://api<tenant host>.successfactors.<eu or com>. You should ask this URL to your SAP SuccessFactors technical administrator.

b. SAP SuccessFactors admin user (or any user with read/write permission on Users/Employee Profiles and appropriate access to OData APIs). This user must be provided in the format: <username>@<company id>

c. User password

After providing the information above, click on Save

NOTE: for the learning purpose of this blog posts series we are using basic authentication in the destination, but be aware that this authentication method is deprecated for productive usage.

5. Click on Check Connection

Figure%207%20-%20Check%20Connection

Figure 7 – Check Connection

6. You should receive the following message:

Figure%208%20-%20Connection%20OK

Figure 8 – Connection OK

Click on Close.

Blog Posts in this Series

Here’s the list of blog posts in this series for you to follow. This is the correct sequence of steps to go through in order to develop the end-to-end application and deploy it to SAP BTP:

  1. Jumpstart the CAP project
  2. Import SuccessFactors OData Services definitions
  3. Define the CDS Data Model
  4. Create the CAP Service
  5. Add Business Logic
  6. Prepare the UI with CDS Annotations
  7. Add Security
  8. Deploy to SAP HANA Cloud
  9. Develop the SAP Fiori Elements Application
  10. Deploy Application to Cloud Foundry
  11. Add Application to the Launchpad

Additional Resources

Here’s a list of resources to enhance your learning journey on CAP:

Stretch Yourself!

There’s a lot of room for improvement in this solution, so don’t miss the opportunity to challenge yourself and go deeper in learning the technologies showcased in this blog posts series by enhancing your application!

Here’s a list of suggestions for enhancements:

  • Directly assign a SuccessFactors employee to a project as the “Project Owner” adding the corresponding assignment to the employee profile
  • Implement a mechanism to remove the assignment from the employee profile whenever he/she is removed from a project team (either by member deletion or replacement). The same would apply to the “Project Owner”
  • Implement validations such as: projects must start at least from the current date (not before) and must end after the start date and activities due dates must be within the project’s start and end dates
  • Implement a mechanism to avoid activities to be added before there’s at least one member in the team to assign them
  • Implement restrictions such as: users can only view/manage projects that have been created by themselves, only employees who report to the project creator can be assigned as team members, etc.
  • And so on, and so forth… the sky’s the limit!

Conclusion

After completing this blog posts series, you’ll have built an end-to-end project management solution which is an extension of the SAP SuccessFactors HXM platform (more specifically the Employee Central module) using the SAP Cloud Application Programming Model with SAP Fiori Elements and deployed on SAP Business Technology Platform.

We hope it’s been a nice learning journey through which you were able to enhance your cloud development skills and, most importantly, really had fun!

Please, do not hesitate to submit your questions in Q&A in SAP Community: https://answers.sap.com/index.html