Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
dvankempen
Product and Topic Expert
Product and Topic Expert












LATEST UPDATE: April, 2021 =========================================

For the latest information, visit














SAP Cloud Platform Extension Factory enables business application developers to focus on creating value-added app extensions and not on the infrastructure.

The Building Extensions for SAP SuccessFactors using APIs video tutorial series from the SAP HANA Academy shows how this can be done. Step-by-step, from scratch, in the patented zero-to-hero format.

In this blog you will find the videos embedded with references and additional information.

Any good? Post a comment, share on social media, and/or give a like. Thanks!


Hands-On Video Tutorials


For the video tutorial series announcement from chief partner engineer, philip.mugglestone, read his blog post

You can watch the ten video tutorials in about 90 minutes. What you learn is

  • How to discover SAP SuccessFactors APIs and give them a spin on the SAP API Business Hub

  • How to use the SAP Cloud SDK to generate the virtual data model and application framework using the API specification

  • How to make OData API calls to your SAP SuccessFactors system using destinations as environment variable for local development

  • How to the same but this time with your app deployed to the SAP Cloud Platform Cloud Foundry environment using the destination and the authentication service

  • How to pair an SAP SuccessFactors system with SAP Cloud Platform

  • How to create an Extension Factory service instance for SuccessFactors

  • How to configure Single-Sign On (SSO) for the destination connection

  • How to deploy a multi-target application (MTA) archive to the SAP Cloud Platform Cloud Foundry environment


Ready? Let's get to work.


YouTube Playlist


To bookmark the playlist on YouTube, go to



Code Repository


Because we know your time is precious, we have included code snippets so you can easily and merrily code along. For the GitHub repository with sample code, go to


1. Getting Started


In the first video, we see the end result of the our efforts: a web application hosted in the SAP Cloud Platform Cloud Foundry environment that displays on a map the location of the candidates from a SuccessFactors system using OData APIs and SSO. Also covered are documentation and prerequisites.

https://youtu.be/5F5QtaIV_I8?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

SAP Cloud Platform Extension Factory


The conceptual view of the Extension Factory has been presented at SAPPHIRE NOW and elsewhere as illustrated, enabling extensions for SAP's Line-of-Business applications (some as planned innovations) with secure and managed connectivity, a central API and event registry, Enterprise Messaging, and a choice of runtimes, programming models, and development tools.



For this scenario, we will be using

  • SAP SuccessFactors and the SAP Cloud Platform (side-by-side extensions)

  • SAP Cloud Platform Extension Factory

  • SAP Cloud Platform Cloud Foundry environment (Application Runtime)

  • SAP Cloud SDK


Development Tool and Programming Model


To develop our application we will be using Microsoft Visual Studio Code as IDE but you could use any another tool that supports JavaScript code development, including the latest SAP Business Application Studio.

There is a bit of buzz lately about the SAP Cloud Application Programming model (CAP) but for this tutorial we are using an older but still perfectly valid model, MTA, for multi-target applications. This model was introduced back in 2016 with XS Advanced and Cloud Foundry. Should you just tune in and need a refresher on this topic, visit

SAP Cloud SDK and OData Client Generator


The Cloud SDK provides JavaScript (and Java) libraries, project templates (best practices), and a continuous delivery toolkit to reduce effort and build better applications on the SAP Cloud Platform. For our application we will not make extensive use of all this but demonstrate the OData Client Generator. For the documentation, visit

What you Need


Dev Box


To follow along you will need the following development tools (Linux, Mac, Windows - your choice).

To deploy applications (videos 5 and 8), we will also install

Free Trial Account


For videos 1-5, we use publicly and freely accessible environments: SAP API Business Hub and SAP Cloud Platform Trial. All you need (and probably already have) are an SAP ID and a SAP Cloud Platform Trial account. This all comes for free. If you need any guidance, go to

If you are new to the SAP Cloud Platform, you might want to browse the onboarding tutorials first

Special Authorisations


SAP SuccessFactors


To make OData API calls to a SAP SuccessFactors company (system), be it demo, test, or production, you need to have an account with the OData Export privilege and this requires access to Admin Center for configuration. We show you what needs to be done (video 4), but this may require the involvement of an administrator. If not within reach, you can continue using the sandbox.

For the SAP SuccessFactors documentation, including OData authentication and operations, see

SAP Cloud Platform Extension Factory


To use the SAP Cloud Platform Extension Factory, we need

  • SAP SuccessFactors Extensibility service entitlement

  • Registered SAP SuccessFactors company (system)


The entitlement is granted at the global account level and is not available in the trial environment. If you only have access to a Cloud Foundry subaccount, you need to have this requested.

This illustration shows the components, services, and actions of the Extension Factory for SAP SuccessFactors.


When we register a system in SAP Cloud Platform the destination is automatically created. Video 6 shows the registration in action and video 8 how create an Extensibility Service instance.

For the documentation about the Extension Factory, go to

SAP SuccessFactors Provisioning


To pair an SAP SuccessFactors company (system) also requires access to the SAP SuccessFactors Business Execution (BizX) Provisioning tool (back-end). It is not rocket science, far from it, but this requires special permissions and may require the involvement of an administrator. As mentioned, video 6 shows the registration. In video 7, we address trust configuration for single-sign on, which also involves the provisioning tool. If not within reach, you can continue with the tutorials for the concepts.

For the documentation, see



2. Discover APIs using the SAP API Business Hub


In the second video, Philip shows how we can try out the SAP SuccessFactors Candidate API on the SAP API Business Hub. With the provided CURL code snippet we can repeat the exercise using Postman.

https://youtu.be/h7sDBuJmwGI?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Try out the SAP SuccessFactors Candidate API in the SAP API Business Hub

  • Execute (and tweak) the HTTP GET API call using Postman

  • Download the API specification


Code


Filter used in the HTTP GET
zip ne null and country eq 'US'

For the sandbox and production URLs and to download the specification in EDMX format, go the API details page


Sandbox HTTP GET query using SAP API Business Hub.


Sandbox HTTP GET query using Postman.



3. Build Extension App using the SAP Cloud SDK


The third video shows the magic of the SAP Cloud SDK in action.

https://youtu.be/rEk1Pf9eATo?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Create a package.json file and install the Node.js dependencies, including the SDK Cloud Generator,

  • Generate the OData client to create the virtual data model (VDM) from the downloaded API specification.

  • Create the application (server.js) with API key to make the sandbox calls, this time from the local development environment using the Visual Studio Code debugger.


Code



  • Download the code snippets for package.json and server.js from GitHub.


Commands


npm set @sap:registry=https://npm.sap.com
npm i
npx generate-odata-client -i service-specs -o generated
# update "servicePath": "/odata/v2"
npx generate-odata-client -i service-specs -o generated --forceOverwrite


Running the debugger in local environment


4. Access Your SuccessFactors System


The next step is to switch from the sandbox environment to a real system using destinations.

https://youtu.be/NKOro8i-f-g?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Using the SuccessFactors Admin Center, grant the user or role permission OData API Candidate Export to the user making the API calls.

  • Create a destination as local environment variable stored as file (.env).

  • Update the server.js file to use the destination environment variable name (and not URL).

  • To run the application locally using the debugger, the configuration is modified to include the environment file.


Code


Example using a destination as environment.
destinations=[{
"name": "sfapi",
"url": "https://apisalesdemo2.successfactors.eu",
"username": "techuser@SYSTEMxxxx",
"password": "******"
}]

Configuration


SAP SuccessFactors Admin Center: Manage Permissions Role > HR Admin for Employees > Permissions… > Recruiting Permissions: OData Api Candidate Export



5. Deploy Application to SAP Cloud Platform (Trial)


Now that we have our local app working, it is time to deploy it to the SAP Cloud Platform. For this we need to create a destination, two service instances, update the app, and run the CF CLI push command.

Steps



  • Create a SAP Cloud Platform trial account (if applicable) and enable Cloud Foundry.

  • Create a destination using the same configuration as the local environment file.

  • Create an instance of the Authorization & Trust Management service (application plan).

  • Create an instance of the Destination service (lite plan).

  • Create a manifest file for the application referencing the services.

  • Update the server.js to parse the environment variable (and not the name).

  • Deploy the application.


https://youtu.be/VLcPqAMTdk0?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Code


The manifest.yml file defines the services and destination.
applications:
- name: sfsdksrv
random-route: true
memory: 256M
disk_quota: 256M
buildpacks:
- nodejs_buildpack
services:
- uaa
- dest
env:
apiDest: sfapi

Commands


# API endpoint of Cloud Foundry subaccount 
cf api https://api.cf.eu10.hana.ondemand.com
# logon with SAP Cloud Platform (trial) credentials and set org and space
cf l
# list services (dest and uua)
cf s
# list applications (none)
cf a
# deploy (cd srv)
cf push
# list applications (sfsdkapp)
cf a
# debug
cf logs sfsdkapp --recent
# remove
cf d sfsdkapp -f
cf delete-orphaned-routes -f
cf ds dest -f
cf ds uaa -f


Create a destination (Cloud Foundry organisation level).


Create service instances (Cloud Foundry space level).

Alternatively, you can create the service instances using the cf CLI.
cf cs xsuaa application uaa
cf cs destination lite dest


6. Extension Factory Pairing


To make OData API calls to a production system and leveraging the SAP Cloud Platform Extension Factory, we need to pair the systems and configure authentication.

https://youtu.be/891MjZixLJM?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Register the SuccessFactors system in SAP Cloud Platform at the Global Account level; this generates a token

  • Add the token using the SAP SuccessFactors Provisioning tool to pair both systems

  • Create a SAP Cloud Platform subaccount (if applicable), enable Cloud Foundry, and create a space

  • Set entitlement for the subaccount

    • Application Runtime: Memory

    • Destination: lite

    • SuccessFactors extensibility: <SYSTEM>:api-access




Configuration



SAP Cloud Platform > Systems > Register System


SAP SuccessFactors Provisioning: Extension Management Configuration > Integration Token: Add


SAP Cloud Platform: Systems


SAP Cloud Platform: Entitlements


7. Configure Trust for SSO


For Single-Sign On, we configure the trust relationship between both systems.

https://youtu.be/IaN2ywx--A8?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Download the SAML metadata from the SuccessFactors system

  • Create a new Trust Configuration for the SAP Cloud Platform Cloud Foundry subaccount by importing the SAML metadata XML file

  • Disable the default trust provider (SAP ID Service)

  • Download the SAML metadata from the SAP Cloud Platform Cloud Foundry subaccount

  • Add the relevant URLs as service provider using the SAP SuccessFactors Provisioning tool


https://<sap_successfactors_system>/idp/samlmetadata?company=<company_id>;

SAML metadata URL SAP SuccessFactors
https://<subdomain>.authentication.eu10.hana.ondemand.com/saml/metadata

SAML metadata URL SAP Cloud Platform

Documentation



Configuration



Create Trust Configuration by importing SAML metadata XML file (Cloud Foundry subaccount level).


Relevant URLs from SAP Cloud Platform SAML metadata


SAP SuccessFactors Provisioning > Service Provider Settings: Authorized SP Assertion Consumer Service Setting: Add


8. Extension Factory Instance


Now that we have paired our SAP SuccessFactors system with SAP Cloud Platform and established trust, we can create an Extension Factory instance for our subaccount.

https://youtu.be/fAqIntiJKrg?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Create an instance of the SAP SuccessFactors Extensibility service (api-access <SYSTEM ID> plan). This will automatically create the destination to this system using the SAML configuration


Documentation



Configuration



Create service instance (Cloud Foundry space level).


9. Adapt App for SSO


In the previous videos (6, 7, 8), we configured our SAP Cloud Platform Cloud Foundry subaccount to make OData API calls to the SAP SuccessFactors system using SSO. Now, we need to modify our application to use this configuration.

Watch the video for the full code review.

https://youtu.be/eYFg8VZJVUs?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Update server.js to include user authentication checks

  • Install dependencies (and update srv package.json)

  • Add xs-security.json file

  • Create an app router with package.json and xs-app.json (defines routing) files and resources directory with index.html (basic or full version with ESRI location map)

  • Create mta.yaml file for deployment at the root level


Code



  • Download the code snippets for server.js from GitHub for step-by-step (or the complete project).


Commands


npm i --save @sap/xsenv @sap/xssec passport


10. Deploy MTA to SCP


With all the configuration and development done, we are ready to deploy our MTA application to SAP Cloud Platform.

https://youtu.be/eHIUIIpqlSg?list=PLkzo92owKnVwHhr85SdCFWlywcaBYk2sC

Steps



  • Install (update) the Cloud MTA Build Tool (for Windows also install make)

  • Log in to the correct environment

  • Install the MTA plug-in for Cloud Foundry

  • Deploy the application


Commands


npm install -g mbt
mbt build
# set the API endpoint and log in
cf l
# install the MTA plugin
cf install-plugin multiapps
cd mta_archives
# deploy
cf deploy sfsdkapp_0.0.1.mtar

Configuration



The deployment has created three service instances


The deployment has created two applications (app and srv)


App populating a map with SAP SuccessFactors OData API calls.


Next Steps


SAP Community


For some must-reads about the Extension Factory on the SAP Community, visit

The factory has its own topic area on the community

Make sure to visit regularly for the latest blogs and Q&A's.



SAP Learning Journey


To go all the way with SAP SuccessFactors extensions, take the learning journey



SAP TechEd


You can still watch two lectures or access the workshops from the CAA1 Learning Journey presented at SAP TechEd 2019.


Learned Something New?


Post a comment, share on social media, and/or give a like. That's how the community works. Thanks.

If you would like to receive updates, connect with me on

Best,

Denys van Kempen


7 Comments