cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HANA Connection in SAP Cloud Portal Widget

Former Member
0 Kudos

Hi all,

I have created an UI5-App which uses a HCP-destination. This destination is defined in neo-app.json. The app and the destination is working fine if testing from webide. All the Data is displayed and the requests work just fine.

Now I would like to add the app as widget in a page of a HCP Portal Service site. I converted my UI5-App to an HCP Portal widget.

When I'm now running my my portal site the odata service can't be accessed.

What things do i have to change in the destination when i want to read the data from SAP Hana Database?

Kind regrets

Timon

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member199536
Active Participant

Hi Timon,

When running the app as a portal widget destination connections need to be "rerouted" through the fiori proxy ( /sap/fiori/<app name> ). For data sources defined in the application's manifest.json the rerouting is done automatically without any special handling on your side.

Otherwise you should handle this in your code. For every destination call calculate the URL with the following function:

calculateURL: function(sPath) {

if(sap.ushell.Container) {
     return sap.ushell.Container.getService("URLHelper").createComponentURI(this.getOwnerComponent().getId(), sPath); 
}else{
     return sPath;
}
},

- The code is invoked from a Controller.js file, otherwise replace this call [ this.getOwnerComponent().getId() ] to provide component ID accordingly.

Let me know if you need more assistace here...

Regards, Ido

0 Kudos

Ido,

We are trying to use the UserAPI in the portal (User Information like the login_name). While we are able to get the same in the individual App, we are noot so succesful in the portal.

We even tried to use your code, but for some reason its not working. So this is what we did

calculateURL: function (sPath) {
if (sap.ushell && sap.ushell.Container) {
console.log("/sap/fiori/"+this.getOwnerComponent().getId()+sPath);
return "/sap/fiori/"+this.getOwnerComponent().getId()+sPath;
//console.log(sap.ushell.Container.getService("URLHelper").createComponentURI(this.getOwnerComponent().getId(), sPath));
//console.log(sap.ushell.Container.getService("URLHelper"));
//return sap.ushell.Container.getService("URLHelper").createComponentURI(this.getOwnerComponent().getId(), sPath);
} else {
console.log(sPath);
return sPath;
}
},

Strangely, we are still not able to get a response from the URL. Any help on this regards will be highly appreciated.