Skip to Content

How to get HCP WebIDE invoke an MDC OData service

Feb 27, 2017 at 09:06 PM


avatar image

I am developing an SAPUI5 template Master Detail application with the HCP webIDE. I have a HANA multi-tenant database MDC through my trial account. I have a sample SAPUI5 application I have developed using the webIDE within the MDC that invokes the OData services no problem. The webIDE within the MDC does not have the nice templates and graphical editor. I would like to develop the application using the HCP webIDE templates since they have the WYSIWYG capabilities with the graphical editor.

I created an HCP destination to my OData service but even though the test connection works with the basic authentication credentials, I am not able to pull up the entities during the design time template HCP SAPUI5 template wizard screens. So I read through several discussions and saw a recommendation to create an EDMX file based on the OData metadata and instead point to this during the wizard. I did that and my SAPUI5 template generated app works in App in FLP Sandbox mode. I was also able to export this app into my MDC content repository and then adjust the neo-app.json and manifest.json files to point to the OData service and change the reference to the SAP Javascript libraries to get this to work. But this is really tedious if I want to continue developing on the SAPUI5 app in the HCP WebIDE.

Is there a simple way to have the HCP WebIDE actually integrate to the MDC OData service without having to implement a workaround NodeJS or other proxy approach? I have read the article - "CORS Issue while consuming Hana's OData" Can't I simply add the CORS configuration through the XS admin tool to enable Basic Authentication and the HTTP methods? I am able to invoke the OData service through the Chrome console but am running into the error: XMLHttpRequest cannot load$metadata. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

The workaround approach articles were written a while back - so I am wondering if SAP has a simpler solution by now.

Thanks for any help in advance.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jay Malla Mar 14, 2017 at 04:31 PM

Actually - I got this to work. I think it was an authentication issue and also a matter of defining the correct information in neo-app.json and manifest.json. I created the following xsoaccess file and placed this in the same folder with my xsodata service in the MDC content repository.

The destination in HCP is set to Basic Authentication.

Here is my xsoaccess file:

{ "exposed" : true, "cache_control" : "must-revalidate", "cors": { "enabled":true, "allowMethods": ["GET","POST","DELETE","PUT"], "allowOrigin": ["*"], "maxAge":"3600" }, "enable_etags" : false, "force_ssl" : false, "prevent_xsrf" : false }

So for anyone who wants to use their trial account and use the HCP WebIDE SAPUI5 templates and call an OData service implemented in their MDC HANA content

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Dear Jay Malla,

Great that you found the fix to this.

I came across your Question, while looking for an Answer to a similar Problem.

I have a Master detail application, to which i load data from a MDC through a HCP trial account. This worked fine, i was able to use the Table data that i needed through a Destination and the OData Services.

I'm currently set on a Task to develop a simple Approval App. I have the lists that i need consumed from the MDC and now i want the Approve Button or the Reject Button to be stored back into the Database, say on Table1.Attribute3 of the specific Tuple.

Would you have any insight on how to store the Data, back from the Fiori Approval app to the MDC ?

I would be most greatful for your answer and Time, and so would surely be someone else, since i have been looking for an answer for a long time and not been able to find anything on this.

Here is a question that i posted yesterday: onApprove - Write to Database.



Hi Sonja,

If you have OData services defined for your tables, you should be able to simple send JSON/XML to the OData service. POST - will be for creating new entries. PUT will be for updating entries. UPSERT would work for Update/insert. If that does not work, simply creating an XSJS that reads the request and insert the data into the MDC tables through SQL. I created a BLOG on how to insert an image which is more complex than you need since your data is just text - but you can refer to this: How to Post an Image from SAPUI5 and Store in HANA DB as BLOB using XSJS

I hope this helps. Sorry for the delayed response.



Jay Malla Feb 28, 2017 at 08:10 PM

Any approaches to address this?

10 |10000 characters needed characters left characters exceeded