2024 Aug 28 8:40 AM - edited 2024 Aug 29 8:05 AM
Dear community,
we are creating a workflow with SAP BPA that uses a custom form. In this form we need to make POST and DEL calls consuming SAP oData.
SAP is reachable via Cloud Connector, the Destination has been created, imported into BPA, Actions have been created to test that everything is working correctly. Up to this point everything is fine.
The problem arises when we try to use these services in the custom approval form controller.
In xs-app-json we added this route
{
"source": "^/odata/(.*)$",
"target": "/$1",
"destination": "sap_process_automation_odata",
"authenticationType": "none",
"csrfProtection": false
},
in form.controller.js we added this code
_updateOdata: function() {
$.ajax({
url: that._getODataURL(),
method: "GET",
async: false,
contentType: "application/json",
headers: {
"X-CSRF-Token": "fetch",
},
complete: function (result, status) {
token = result.getResponseHeader("X-CSRF-Token");
console.log("SapToken: " + token);
},
});
/* OTHER CODE*
}
_getODataURL: function () {
var appId = this.getOwnerComponent().getManifestEntry("/sap.app/id");
var appPath = appId.replaceAll(".", "/");
var appModulePath = jQuery.sap.getModulePath(appPath);
return appModulePath + "/odata/sap/ZODATA";
},
What I expect to happen with this code is to get the token to use for the next POST or DEL call, but the call fails with a 500 or 404 error.
The way the route is configured, the address should resolve to
https://<host>:44301/sap/opu/odata/sap/ZODATA
but evidently something is not correct.
I add that this form allows you to write and read files in the BTP Document Management Service via API, using a very similar approach and this is working.
I have done this in the past on other custom task forms, but with Workflow Manager (maybe there is some difference that we have not noticed).
Anyone have any suggestions?
Thanks and Best Regards,
Giampaolo
I add the correctly formatted code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SOLVED!
The approval form generated with the BAS does not have the default_connectivity and default_destination service references in the mta.yml file.
In order to use onPremise type destinations, it is therefore necessary to:
At this point, the onPremise destination will be usable.
User | Count |
---|---|
81 | |
11 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.