on 02-01-2015 2:25 PM
Dear All
I have created a Odata service. It is working in browser.
However, It is not accessed from the Jquery Ajax
It is adviced that to include a
ls_header-name = 'Access-Control-Allow-Origin'.
ls_header-value = '<server>:<port>'.
/iwbep/if_mgw_conv_srv_runtime~set_header( ls_header ).
.
But, I am confused in which method I should add it.
Can Someone help me
My Class name
ZCL_ZGL2_DPC_EXT
My mehtod for entityt set GLLISTSET_GET_ENTITYSET
do i need to add it inthis method?
Regards,
Venkat
Hi Venkat,
How about using below code to resolve Access-Control-Allow-Origin
function getUrl(sUrl){
if (sUrl == '')
return sUrl;
if (window.location.hostname == 'localhost'){
return "proxy" + sUrl;
}else {
return sUrl;
};
}
var serviceUrl = getUrl('/sap/opu/odata/sap/Service_Name/');
var oModel = new sap.ui.model.odata.ODataModel(serviceUrl,false,null,null);
sap.ui.getCore().setModel(oModel, "Model");
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.