SAP Hana云平台CRUD问题

时间:2015-05-31 12:09:01

标签: javascript sap hana hana-cloud-platform hana-xs

我试图在Hana云平台上做一个简单的粗略视图,但我仍然坚持创建部分。我用以下方式定义了hdbdata

`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 to Addresses null;
`

我的控制器中的方法就像这样定义了

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");
    });

},

但无论我如何设置名称,我都会收到错误

31 15:01:34发生以下问题:HTTP请求失败400,错误请求,{"error": { "code": "", "message": { "lang": "en-US", "value": "Request contains properties that do not exist in entity 'UsersType'."}}} - ...

任何人都可以帮我解决如何将名称命名为创建过程吗?

0 个答案:

没有答案