3 weeks ago
Triggering SAP Build Process Automation Workflow from a Custom SAP Fiori Application
In this blog, we'll explore h to integrate SAP Build Process Automation with a custom SAP Fiori application. This involves creating a workflow in SAP Build Process Automation, setting up an API trigger, and calling this workflow from a Fiori application.
Steps to Trigger the Workflow
Navigate to the SAP Build Process Automation application.
Select Business Process
Payload: {
"definitionId": "us10.cpi-workzone-dev-z49850t9.customfioriapproval.customApprovalProcess",
"context": {}
}
7.Creating a Data Type and adding this data type to our trigger.
Click on configure button and add input.
Similarly add process output
Save, Release and Deploy
Now our api trigger is updated with process input variable and we can trigger the API from any UI5 application.
To trigger SAP Build Process API, you need a destination to be created in BTP cockpit.
Create an instance of SAP BUILD PROCESS AUTOMATION
Create a service key
Create a service key
Create Destination using client Id and clientsecret
Code to trigger Build Process Automation from UI5 application, in controller add the below method
_workFlowCall: function (oData) {
var url = "/spa_process_destination/v1/workflow-instances";
var sUrl = this._getExternalServiceRuntimeBaseURL() + url;
var payload = {
"definitionId": "us10.cpi-workzone-dev-z49850t9.customfioriapproval.customApprovalProcess",
"context": {
"vendordetails": {
"vendorNumber": ""
}
}
}
$.ajax({
url: sUrl,
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(payload),
beforeSend: function (xhr) {
xhr.setRequestHeader("Accept", "application/json");
},
success: function (response) {
console.log("Success: ", response);
}.bind(this),
error: function (error) {
console.log("Error in POST call:", error);
}
});
},
_getExternalServiceRuntimeBaseURL: function () {
var oComponent = sap.ui.core.Component.getOwnerComponentFor(this.getView());
if (oComponent) {
var sAppId = oComponent.getManifestEntry("/sap.app/id");
var sAppPath = sAppId.replaceAll(".", "/");
var sAppModulePath = jQuery.sap.getModulePath(sAppPath);
return sAppModulePath;
} else {
console.error("Component could not be found.");
return "";
}
},
Key Points
By following these steps, you can successfully trigger SAP Build Process Automation workflows directly from a custom SAP Fiori application, enhancing automation and integration capabilities.
3 weeks ago
Hi Santosh_RG,
Thank you for sharing such an insightful blog. I attempted to implement this scenario on my trial account but encountered an error in my browser's network and console.
BTP Destination:
I need your guidance.
Thank you in advance
Manisha Jha
2 weeks ago
Hi Manisha,
After creating a destination in BTP for the SPA api.
2. Configure the destination in ui5.yaml file
3. configure the destination in xs-app.json file
4. Build and deploy to BTP.
Now, you can check SAP Build Process -> Monitoring -> Process and Workflow Instances
Thanks,
Santosh