javascript - SAP Hana cloud platform CRUD issue -
i'm trying make simple crud view on hana cloud platform, i'm stuck on create part. have hdbdata defined in following way
`type namet { first : sstring; middle : sstring; last : sstring; initials : businesskey; entity user { key userid: businesskey; name: namet; sex: string(1); phone: sstring; emailadress: sstring; loginname: string(12); addressid: association addresses null; `
and have method in controller defined this
newuser: function() { var omodel = new sap.ui.model.odata.odatamodel("../services/user.xsodata/", true); var oentry = {}; var name = {} oentry.userid = "0000000000"; name = {}; name.first = sap.ui.getcore().byid("firstnamefield").getvalue(); name.middle = sap.ui.getcore().byid("middlenamefield").getvalue(); name.last = sap.ui.getcore().byid("lastnamefield").getvalue(); oentry.name = name; oentry.loginname = sap.ui.getcore().byid("usernamefield").getvalue(); oentry.sex = sap.ui.getcore().byid("sexbox").getvalue(); oentry.phone = sap.ui.getcore().byid("phonefield").getvalue(); oentry.emailadress = sap.ui.getcore().byid("emailfield").getvalue(); //oentry.addressid = "1" //model.getproperty("addressid", otable.getcontextbyindex(otable.getselectedindex())); omodel.setheaders({ "content-type": "application/json;charset=utf-8" }); omodel.create('/users', oentry, null, function() { alert("create successful"); }, function() { alert("create failed"); }); },
but no matter how try set name, error
31 15:01:34 following problem occurred: http request failed400,bad request,{ "error": { "code": "", "message": { "lang": "en-us", "value": "request contains properties not exist in entity 'userstype'."}}} - ...
can me out on how name across create procedure?
Comments
Post a Comment