We had a requirement to bring in SFSF LMS “Learning Approvals” into SAP HCM and to be able to approve or reject these items from SAP. Although SFSF LMS exposes various entities as OData V4 APIs, when trying to integrate with SAP HCM there were a few questions on the approach:
A quick search on both PI/PO and Successfactors communities reveals that there has been a lot of work already done covering integration scenarios for SF Bizx, EC and SF LMS (standard SAP delivered content or earlier version of LMS APIs). There is very little information that we could find on how to integrate the latest SFSF OData V4 LMS APIs using SAP PI.
I started off with the NW PI Connectivity add-on 1.0 “SFSF Adapter” and “OData Adapter”. While this is a good starting point, soon I found that there are limitations on how these adapters can be used to consume SFSF LMS APIs. There are many discussions on the SFSF LMS forums on the issues faced in consuming LMS OData V4 using PI/PO.
After going through various “PI REST Adapter” blogs, SAP documentation and looking at the generic nature of the adapter, I decided to give the REST Adapter a try.
The second question, how do we convert the JSON to XML and vice versa? Again there are some wonderful blogs stating how this can be done by using:
Finally, Creating XSD for the SFSF LMS APIs to carry out the required mapping in PI. The plan was to use Eclipse (Mars) “Modelling operations” to generate the XSDs but again looking at the options available, this was not possible for SFSF LMS APIs.
Eg: When using Successfactors adapter with REST or OdataV4 protocols the “Modelling operation” option is not available and with OData V2 protocol “Modelling operation” does not allow authentication using the SFSF LMS “Client Secret”.
This required a bit more investigation to come up with a set of repeatable steps to generate XSD and which could be potentially applied on other scenarios. The guide will cover the steps I used during this POC.
This guide will focus on how the second flow is implemented to retrieve “Learning Approval” items from SFSF LMS. Other flows are implemented in similar way but are not covered in this document.
Step 6: Upload and validate the XSD in ESR as External Definition (ED_LearningApproval) for Response.
Step 7: Repeat the above steps to create the external definition for handling “Requests”. In this flow, we only require an empty XSD to pass the OAuth Token. See ESR steps for more details.
Step 1: Create new Data Type and Message Type for both Request and Response as required in the Sender system (SAP HCM).
Step 2: Create the Outbound and Inbound Service Interfaces (Synchronous)
Inbound:
NOTE: The request External Message is a Dummy XSD with message name “root”. Not to confuse with the Response External message name which also has a message name “root”? - Should have named it differently !
Request: MT_LearningApprovalRequest to External Definition (empty)
NOTE: In this particular scenario we are going to use the Request mapping to take the OAuth Token to the REST Adapter HTTP Header (Generated in the first flow).
Moving on to Integration Builder, we will first configure the channels and use standard REST Adapter JSON to XML conversion.
The “oauth_token” is taken from mapping following XPath and then passed through the HTTP Headers.
There are two options to handle the payload conversion, One could choose between the “Standard REST Adapter” JSON to XML conversion as shown here
To run the interface, a test ABAP program was created which gets the “User ID” in selection screen and triggers two interface calls into SF LMS.
The initial call is to get the OAuth token and then the second call to retrieve any pending “Approval items” from SF LMS by passing the received OAuth token.
By clicking the “Tap ID” the user will be given option to “Approve” or “Deny” and respective APIs are called(which is the third flow).
The final implementation will be looking at creating SAP Workitems and pushing it to a custom mobile approval app, which is currently used at our site.
Following shows the request/response log and also shows the JSON to XML conversion of payload using the standard REST Adapter:
I hope the above approach or parts of it will be useful as a guide to integrate SFSF LMS APIs (OData V4) using SAP PI REST Adapter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |