Hi experts,
I have a SAP UI5 Freestyle application deployed on BTP, it uses several APIs published for SAP Public Cloud, including:
The first two APIs work well but not the other three. I kept getting 403 errors for them.
The destination on BTP is configured using SAML Assertion, and the communication system on the Public Cloud has also activated SAML Bearer Assertion Provider. Hence it's not using BASIC authentification, and no communication user is involved if I'm not mistaken.
I initially also encountered 403 errors when accessing API_BUSINESS_PARTNER and API_SALES_ORDER_SRV. However, assigning BR_BUPA_MASTER_SPECIALIST and BR_SALES_MANAGER to my user on Public Cloud resolved the issue and granted access.
I assumed that assigning additional Business Roles would grant access to other APIs, but unfortunately, that was not the case. Below are the roles I assigned, expecting them to provide access to other APIs:
In manifest, I declare all APIs one by one as below:
"API_SALES_ORDER": {
"uri": "/sap/opu/odata/sap/API_SALES_ORDER_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
},
"API_MATERIAL_STOCK": {
"uri": "/sap/opu/odata/sap/API_MATERIAL_STOCK_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
},... etc.
In controller, they are consumed in a classic way:
const oModel = this.getOwnerComponent().getModel("myLocalJSONModel");
const oAPIModel = this.getOwnerComponent().getModel("API_MATERIAL_STOCK");
const oSelectedItem = oModel.getProperty("/selectedItem");
if (oSelectedItem) {
try {
const sPath = `/A_MaterialStock('${oSelectedItem.Material}')`;
oAPIModel.read(sPath, {
urlParameters: {
"$expand": "to_MatlStkInAcctMod"
},
success: (oData) => {
// do something with oData
},
error: (oError) => {
// do something with oError
}
});
} catch (error) {
// do something with error
}
}
Note that the same syntax works well with sales order API and business partner API. And I'm only doing READ at the moment.
However, I can access to metadata from the browser:
Can anyone provide some information on how to unblock the situation? 🙏🙏🙏
P.S. I know that it's suggested to use CAP or Cloud SDK to develop custom UI for Public Cloud, but at this moment I'm not deploying the app to Public Cloud but only BTP. So let's try to stay in the current tech stack (UI5 + standard APIs) unless it's really not possible.
Useful links that I already have:
UPDATE:
I have created a custom role in Public Cloud that contains all the Business Catalogs available (1000+), and still no access to certain APIs. (Ex: API_PRODUCT_AVAILY_INFO_BASIC, API_SALESORGANIZATION_SRV)
Request clarification before answering.
Hello @diella
Thanks for sharing the details of your setup, which helped a lot in narrowing down the issue. The 403 errors aren’t random; they usually indicate one of two things.s:
Here’s what applies to the specific services you mentioned:
Why you can see $metadata in the browser but not from your UI5 app: your browser session runs under your full interactive login, while the app uses whatever is defined in the BTP destination. If the API doesn’t allow SAML bearer, or if the propagated user doesn’t meet the restriction checks, you’ll encounter a 403.
Recommended next steps:
That should unblock the services that are failing.
Let me know if you need further support
Best regards,
Chuma
GenAI assistance content
SAP Usefull references
Verify that you have active communication arrangements for each API’s scenario 0009, 0164, 0087.
• Reference: Communication Arrangements – SAP Help Portal
For Material Stock, add the missing restriction values, such as Plant, in IAM for your business role.
• Reference: IAM Information System – SAP Help Portal
For the Sales Organisation, create a BasicAuth destination with a communication user — SAML bearer authentication will not work there.
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 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.