Skip to Content
0
Former Member
Aug 11, 2016 at 01:36 PM

oDataModel not accepting credentials

69 Views

Hello everyone, I'm currently having an issue with calling a webservice from a pure html and JS page I've created as a test.

I've looked everywhere and I don't seem to be finding the answer.

It seems that the credentials are not being added to the call somehow.

This is the code I'm using:

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

local.com">

<meta http-equiv="Access-Control-Allow-Headers" content="X-KEY">

<script

src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"

id="sap-ui-bootstrap"

data-sap-ui-libs="sap.m, sap.ui.commons"

data-sap-ui-theme="sap_bluecrystal">

</script>

<script>

var user = "user";

var password = "password";

var oModel = new sap.ui.model.odata.ODataModel("http://vir-brd-01.alfa.local:8001/sap/opu/odata/sap/YBE_ULTIMATE_SRV", true, user, password);

var customerNumber = "200000";

var oInput2 = "SYEDX";

var oEntry = {};

oEntry.Kunnr = customerNumber;

oEntry.Ort01 = oInput2;

sap.ui.getCore().setModel(oModel);

sap.ui.getCore().getModel().update("/ZULTI_ETSet", oEntry, null, function(oResponse){

alert(oResponse);

}, function(){

alert("Failed");

} );

</script>

</head>

<body class="sapUiBody" role="application">

<div id="content"></div>

</body>

</html>

Attachments