on 2024 Jul 23 1:04 PM
Hello Community,
We have built form trigger for a process automation that we have built on BTP -Build process automation, we are able to test the form trigger with the generated Url link for the form.
But how can we create a Fiori tile on S4 HANA public cloud Fiori launch pad for this BPA form where the business users can have access to these tile and trigger the automations.
We have tried to create tile using Custom Catalog but question here is that we can give a static Url in the custom catalog app, but when the BTP sub account is different is for Dev and Prod environments then BPA form link will also be changing. in this case how can we create a Fiori tile which will dynamically points to the correct BPA form in all the environments ( Dev and prod).
SAP Build Process Automation SAP Build SAP S/4HANA Cloud Public Edition SAP Fiori
Thank you for your question, @munipkumar.
To ensure that your Fiori tile dynamically points to the correct BPA form in different environments (development, test, and production) in an SAP S/4HANA Cloud Public Edition 3-system landscape, you can follow these steps:
URL Alias Configuration:
Destination Configuration in SAP Cloud Platform:
Component.js Configuration:
Dynamic URL Calculation:
Here's a more detailed approach to the solution:
Create destinations named logically, such as DEV, TEST, and PROD.
Example:
Enhance the Component.js of the Fiori application to read the environment and dynamically adjust the URL.
Example:
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"my/custom/application/model/models"
], function (UIComponent, Device, models) {
"use strict";
return UIComponent.extend("my.custom.application.Component", {
metadata: {
manifest: "json"
},
init: function () {
UIComponent.prototype.init.apply(this, arguments);
// Initialize router
this.getRouter().initialize();
// Set device model
this.setModel(models.createDeviceModel(), "device");
// Dynamically set the BPA URL based on the environment
this.setBPAFormURL();
},
setBPAFormURL: function() {
var oEnvironment = this.getMetadata().getManifest()["sap.cloud"]["environment"];
var sBPAURL;
switch(oEnvironment) {
case "development":
sBPAURL = "https://dev-bpa-form-url";
break;
case "test":
sBPAURL = "https://test-bpa-form-url";
break;
case "production":
sBPAURL = "https://prod-bpa-form-url";
break;
default:
jQuery.sap.log.error("Unknown environment: " + oEnvironment);
}
this.setModel(new sap.ui.model.json.JSONModel({
bpaFormURL: sBPAURL
}), "bpaModel");
}
});
});
3. Using URL in View
Bind the URL in your view to new model properties as defined.
Example (XML view):
<Button text="Open BPA Form" press="onOpenBPAForm"/>
Example (Controller):
onOpenBPAForm: function() {
var sBPAURL = this.getView().getModel("bpaModel").getProperty("/bpaFormURL");
sap.m.URLHelper.redirect(sBPAURL, true);
}
Ensure that the Fiori tile setup in the Fiori Launchpad Designer does not use hardcoded URLs.
Example:
In this method, the application reads the environment and sets the appropriate URL for the BPA form ensuring that users are directed to the correct environment-specific URL dynamically. This approach minimizes the chances of hardcoding errors and environment mismatches. Ensure appropriate testing in all environments post implementation.
If this solves your request please mark accordingly. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.