Intro
Reporting on process-related governance tasks and cases can be a time-consuming and disconnected process for process owners and modelers, resulting in limited visibility on governance cases and their impact on other business KPIs. Our Analytics API enable effortless and direct reporting of approval cases, including case attributes, in external BI tools.
This blog will show you how to use SAP Integration Suite, cloud integration to fetch data from SAP Signavio Process Governance and replicate it to SAP Datasphere. You can use this flow as well as a blueprint for a script-based integration or for using a different middleware or a different data analytics tool.
Use Case
With SAP Signavio Process Governance Analytics API, users can gain visibility on governance cases across SAP Signavio, have better context by having governance cases information next to main business KPIs, and save time and cost by having direct process governance in their tool of choice. The following steps are needed to use the data in an external tool:
- Create an API Key in SAP Signavio Process Governance
- Configure SAP Datasphere
- Use SAP Integration Suite, cloud integration to
- fetch data of a specified SPG Case
- map data to JDBC XML
- Push data via JDBC to SAP Datasphere
- Check data in SAP Datasphere
Implementation
Architecture
Create an API Token in SAP Signavio Process Governance
You need to create an API token to access the SAP Signavio Process Governance Analytics API. Login to SAP Signavio Process Governance and click on “Services & Connectors”:
Select “Token Management” and click on “Generate new token”:
Specify a token description and select a user to grant the permission for a one time token creation. This user will receive a mail to create the token:
Click on the link in the e-mail to create the token:
You are redirected to SAP Signavio and able to copy the token. Please make sure to keep it safe as it will be no longer accessible when you leave the page:
Please find more details in the
API Documentation.
Configuration in SAP Dataphere
This blog doesn’t describe the detailed steps to be done in SAP Datasphere. Please refer to
this blog instead. Make sure you meet the following prerequisites:
1. Create a space in SAP Datasphere Space Management
2. Create a new Database user in the created space. The user credentials are needed for the JDBC Data Source in SAP Integration Suite, cloud integration
3. Create the table in the SAP HANA Database Explorer. We use a table called “SPG_CASES” with two columns “C_ID” and “C_NAME”
4. Copy the Host name and Database from the Properties
Configuration in SAP Integration Suite, cloud integration
- Add Secure Parameter for the API Token
Create a Secure Parameter in SAP Integration Suite, cloud integration to persist the API Token securely. The name is afterwards used within the Integration Flow to authenticate and fetch the data.
2. Add JDBC Material for SAP Datasphere
Create a JDBC Data Source for access SAP Datasphere with the following parameters:
- Name/Description
- Database Type: SAP HANA Cloud
- User/Password: The user you specified in SAP Datasphere
- JDBC URL: URL to SAP Datasphere with the following pattern: jdbc:sap://<hostname>.hanacloud.ondemand.com:443/?databaseName=<databaseName>&encrypt=true
IFlow Development in SAP Integration Suite, cloud integration
We need one Integration Flow to fetch, map and replicate the data:
- Start event
use a timer, which is scheduled once to test the integration. In a productive scenario, this Integration Flow might run periodically.
2. Configure Secure Parameter to fetch it in a Groovy Script
Add an Exchange Property “secureParameterName” and externalize the value. This property is fetched in the next step within a Groovy Script to set the Authorization HTTP header:
3. Set HTTP Authorization Header
A small Groovy Script is needed to fetch the Secure Credential Name from the externalized Parameter and fetch the API Token from the Secure Storage by using the name we specified earlier. Set the Bearer Authorization Header by using the API Token:
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import com.sap.it.api.ITApiFactory;
import com.sap.it.api.securestore.SecureStoreService
import com.sap.it.api.securestore.UserCredential
import com.sap.it.api.securestore.exception.SecureStoreException
def Message processData(Message message) {
def secureStorageService = ITApiFactory.getService(SecureStoreService.class, null);
try{
def credentialName = message.getProperty("secureParameterName")
def secureParameter = secureStorageService.getUserCredential(credentialName);
def accessToken = secureParameter.getPassword().toString();
message.setHeader("Authorization", "Bearer "+accessToken);
} catch(Exception e){
throw new SecureStoreException("Secure Parameter not available")
}
return message;
}
4. HTTP Request to SAP Signavio Process Governance API
Configure the HTTP request by using the URL described in the API documentation. Externalize the host (“host”) as well as the Case ID (“caseID”) for later configuration. Make sure to specify that the Authorization HTTP header is passed:
5. Convert response from JSON to XML
In order to map the data conveniently, convert the JSON response to XML:
6. Map field data and specify database table in SAP Datasphere
Create exchange properties to specify the SAP Datasphere database table by using an externalized parameter (“datasphereDatabaseTable“). Map the data from the XML response to external fields by using XPath. In this we focus on Case ID and Case Name, this could be repeated for further attributes:
7. Create the JDBC XML Payload
Use a Content Modifier to create the JDBC XML payload and make sure to add the correct Exchange Properties specified earlier. The structure depends on the database structure in SAP datasphere. In this example, we insert a new record in the specified database table with the case ID (column name “C_ID”) and the case name (column name “C_NAME”):
<?xml version="1.0" encoding="UTF-8"?>
<root>
<insert_statement>
<dbTableName action="INSERT">
<table>${property.datasphereDatabaseTable}</table>
<access>
<C_ID>${property.caseID}</C_ID>
<C_NAME>${property.caseName}</C_NAME>
</access>
</dbTableName>
</insert_statement>
</root>
8. Send data to SAP Datasphere
Add an externalized parameter for the JDBC Data Source Alias for configuration (“jdbcDataSourceAlias“):
Create a new Case in SAP Signavio Process Governance
1. Start a new Case in SAP Signavio Process Governance
2. Copy the Case ID from the URL in the browser
Configure the Integration Flow in SAP Integration Suite, cloud integration
Configure the externalized parameters:
- caseID: The Case ID of the case created in SAP Signavio Process Governance
- datasphereDatabaseTable: The name of the table created in SAP HANA Database Explorer
- host: the host/server according to the API Docs
- jdbcDataSourceAlias: The name of the JDBC Data Source created in SAP Integration Suite, cloud integration
- secureParameterName: The name of the Secure parameter which holds the API Token created in SAP Integration Suite, cloud integration
Deploy and Run the integration
After you specified all the necessary parameters, you can deploy the Integration Flow and check the monitoring:
Open the Data Builder in SAP Datasphere to check the result:
This blog provides a detailed step-by-step tutorial for you to fetch cases data from SAP Signavio Process Governance and replicate the data to SAP Datasphere using SAP Integration Suite, cloud integration. This helps to gain visibility on governance cases across SAP Signavio and have a better context by having this data next to main business KPIs.
Please, do not hesitate to post your questions and feedback and tell us about your analytics scenarios! If you want to learn more about other exciting updates from the November market release, please read our
latest blog post.