In this blog, you’ll learn how to build, deploy and run sample Benefits java extension application on the SAP Cloud Platform trial account. The Sample benefits is cloned from the application repository from GitHub , application is build using the maven build and finally deploy the application binary to SAP Cloud Platform trial account.
SAP Employee Benefits Management is a sample extension application for SuccessFactors Employee Central. By making use of authorization objects this extension application serves different persona’s like employee and HR benefits administrator. The application can be used by employees to make orders in specific benefit campaigns and by HR managers to manage employee benefits and set up new benefit campaigns based on role assigned to them.
This sample application reads data from SAP SuccessFactors using OData API’s and uses Persistency to store certain data like benefits campaigns , employee benefits assignment and employee orders on SAP Cloud Platform database layer. Read documentation on GitHub to understand more about application use cases, functionality and architecture. We are going to use SuccessFactors OData API Test system as SuccessFactors instance to consume OData API’s.
This blog is mainly intended for learning purposes and most importantly to showcase how to deploy java extension application, protect extension application by roles , how to make OData call to SuccessFactors, how to persist data on HANA database on SAP Cloud Platform trial account.
In the next blog”coming soon”, I will explain how the same java extension application when deployed to extension account can leverage some of the benefits of extension package for SuccessFactors.
- Java JDK (Java SE Development Kit), version 7 or greater
- Eclipse IDE – Latest version like “Neon” or “Oxygen”
- SAP Cloud Platform SDK
- SAP Cloud Platform tools for Eclipse
- Git plugin for eclipse
- Maven Plugin for eclipse
Setting Up the Development Environment : Before you can start developing your application, you need to download and set up the necessary tools, which include Eclipse IDE for Java EE Developers, SAP Cloud Platform Tools, and SDK.
SAP Cloud Platform Tools, SAP Cloud Platform SDK for Neo environment, SAP JVM can be downloaded from the SAP Development Tools for Eclipse page.
A step-by-step procedure on how to configure the Eclipse IDE for Java development on SAP Cloud Platform, Please refer the link.
To install Maven plugin for eclipse IDE refer this link (Step1 /Step5 /Step 6)
Refer this link for any trouble shooting tips during initial set-up .
Note:- SAP Cloud Platform trial account is not suited for productive extension application development. It should be only used only for learning purposes.
Define destination to SuccessFactors OData proxy instance on SAP Cloud Platform trial account
Step1: Logon onto SAP Cloud Platform trial account
Step2: Navigate to destination tab under Connectivity, Click on new destination.
Step 3: Create new destination, which basically defines outbound connection to SuccessFactors OData proxy instance which will be used by benefits java application later to consume OData service.
|Description||SuccessFactors Proxy Core OData API|
|User||<SAP Cloud Platform trial account user id>|
|Password||<SAP Cloud Platform trial account password>|
Steps: How to deploy Java extension sample application to SAP Cloud Platform trial account
Step1: Launch Eclipse and switch to Git perspective and select Clone a Git repository
Step2: Copy URL https://github.com/SAP/cloud-sfsf-benefits-ext.git and select TechEd2017 for Branch Selection by leaving everything else as default.
Click next and complete the wizard. Now you should see cloned project.
Step3: Switch to the Java EE perspective and import the just cloned maven project from the previous step.
Select File -> Import -> Existing maven project, select next.
Enter the path to the folder where you had cloned the Git Repository and Click Finish
Step4: The Sample Benefits application is imported into eclipse
Step5: Build the application ( Right click on the project and select Run as Maven Build)
Step6: Specify goal type
For example: clean install –Dbenefits.id=001
Step7: Make sure that you got BUILD SUCCESS status in the Console view
Step8: Deploy application to SAP Cloud Platform trial account
Step9: Choose Server type as SAP Cloud Platform,and provide region host as hanatrial.ondemand.com since we are using trial account. Finally click on Next.
Step10: Provide Application name, select Java Web Tomcat 8 as run time, specify your SAP Cloud Platform trial account name and SAP Cloud Platform trial account user name and password. Complete the wizard to trigger deployment process.
Step11: If everything goes fine with deployment, You should see application in started status. Extension application can be opened either both eclipse as shown below or SAP Cloud platform cockpit.
Step12: Logon to SAP Cloud Platform trial account, Navigate to Applications -> Java Applications -> Benefits application ( Application that you deploy in step10) , click on Application URL’s to execute application.
Step13: Your application should display three tiles as shown below. Benefits Catalog and My orders and About Me tiles which can be accessed by any logon users. Benefits Catalog and My orders data is coming from HANA database that application uses as data source bindings during deployment. About me, data is coming from proxy OData SuccessFactors instance which display data for the current logon user and manager.
Note:- Even though your using SAP Cloud Platform trial account user id and password as part destination definition, all the users will be mapped to nnash user id when OData calls are made to proxy OData SuccessFactors instance.
Step14: Under Benefits application navigate to Security tab -> Roles section. You will notice that re 2 application roles got imported into cockpit during application deployment. You check these application role definition in web.xml in the java application. Now that’s go ahead assign SAP Corporate Benefits Administrator role to your SAP Cloud Platform trial account user id.
select the application role ,click on Assign option and specify your SAP Cloud Platform trial account user id.
Note:- Authorization management or role shown in trial account is not the same when you deploy to extension account. With extension account, you can import custom role into SuccessFactors and make SuccessFactors as a provider which will be discussed in my next blog in detail.
Step15: Go ahead and open application URL in incognito window to avoid caching issues. You notice that your application now has 5 tiles. That’s because now you have logged in as Benefits administrator. As a Administrator you can create new Benefits Campaigns and Manage benefits of Employees.
Click on Manage Benefits of Employee tile and assign few Order as shown below by clicking on Add New Order button at the bottom end of screen.
Click on Benefits Campaign Tile, Go ahead and create few Benefits Campaign by clicking on Add button, specifying Start Date and End Date and finally active it .
Step16: unassign Administrator roles in step 14 and logon as Employee. Click on My Order tile and create some orders.
Step17: Click on About me tile, check out information fetched from OData Proxy SuccessFactors instance.
Hopefully this blog gave you an overview about all the steps involved in Java extension application deployment on SAP Cloud Platform trial account. You can go check out all the Java code to understand how all the functionalities are build. if you notice benefits sample application uses SAP UI5 technology for front end UI which is embedded within Java application, all the business logic is written in java application and how authorization concept can be used protect access to multiple tiles based on roles within the extension application.
In the next blog, i will explain how the same benefits application can be deployed to extension account paired with SuccessFactors instance. You will understand the differences in terms of deployment steps and some advantages offered by extension package for SuccessFactors to automate some of the deployment steps and also how to take advantage of SuccessFactors Role based permission concepts for authorization.
Want to learn more about SAP SuccessFactors Extensions on SAP Cloud Platform, check out SuccessFactors extension learning journey for developers.
Happy Learning !!