Technical Articles
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 posts 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 HANA Cloud, 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:
- Each project is composed by members (team) and activities;
- The project team (members) is made of SuccessFactors employees;
- Each project member has an specific role in the project;
- Each project activity is assigned to a specific project member;
- Projects and activities have one status each (i.e. not started, in progress, overdue, completed etc.);
- 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 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 an 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 posts series.
Data Model
Here’s a diagram representing the data model for the application.
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Ā
IMPORTANT UPDATE: As of January, 12th, 2023, SAP Launchpad Service has been re-branded to SAP Work Zone Standard Edition. As it’s been just a product renaming, there’s no impact on the functionality, hence not requiring any changes in the procedures described in this blog posts series. Therefore, wherever you read SAP Launchpad Service in the blog posts, please read SAP Work Zone Standard Edition.
This is the list of requirements to develop the solution:
- First of all, you’ll need an SAP BTP Trial Account which you can get following this tutorial;
- 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;
- In your Business Application Studio, create a dev space for Full-Stack development.
- 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);
- To use the HTML5 applications repository and add the application to the launchpad we will need to setup the SAP Work Zone Standard Edition (formerly SAP Launchpad Service). You can do it following this tutorial.
- 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 3 – SAP BTP trial access
2. On the left-hand side, expand the Connectivity section and click on Destinations
Figure 4 – Access Destinations
3. On the right, click on New Destination
Figure 5 – New Destination
4. Fill-up the destination information according to the screenshot and instructions below
Figure 6 – Destination Information
a. URL of your SAP SuccessFactors API tenant. Usually it follows 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 and will be replaced by OAuth 2 authentication. To learn how to setup OAuth 2 authentication in your production environment you can refer to this link from the SAP SuccessFactors HXM Suite OData API: Developer Guide.
5. Click on Check Connection
Figure 7 – Check Connection
6. You should receive the following message:
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 application end-to-end and deploy it to SAP BTP:
- Jumpstart the CAP project
- Import SAP SuccessFactors OData Services definitions
- Define the CDS Data Model
- Create the CAP Service
- Add Business Logic
- Prepare the UI with CDS Annotations
- Add Security
- Deploy to SAP HANA Cloud
- Develop the SAP Fiori Elements Application
- Deploy Application to Cloud Foundry
- Add Application to the Launchpad
Additional Resources
Here’s a list of resources to enhance your learning journey on CAP:
- SAP Cloud Application Programming Model (CAP) – Learning Journey
- SAP Cloud Application Programming Model (CAP) – SAP Community
- Developing with the SAP Cloud Application Programming Model
- Building Applications with SAP Cloud Application Programming Model – openSAP Course
- In-depth CAP focused video tutorials & other resources
- Video Tutorials on CAP Model focusing on Java
- SAP Developer Tutorials focus on SAP CAP
- CAP official documentation
- Mission: Extend SAP SuccessFactors on SAP Business Technology Platform
- Mission: Create a Project Management Application consuming Business Events from SAP SuccessFactors and Event Mesh
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 an SAP 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, SAP HANA Cloud and SAP Fiori Elements, 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
Looking forward to the next posts.
Hi Martin,
Thanks for reaching out!
The posts will be done on a daily basis, following the rules of SAP Community (no more than one post per day is allowed).
Today I posted the second step.
Stay tuned!
Best Regards,
Alessandro
Awesome blog series!
Looking forward to the Kyma version š
Thanks Tim Douvis.
I'm quite busy with other assignments right now, but I'll try to do it as soon as I've got some time.
Best Regards,
Alessandro