Skip to Content
0
Former Member
Apr 16, 2014 at 10:09 AM

Issue with ODataModel.create()

403 Views

Hey everyone,

I'm facing an issue with the sap.ui.model.odata.ODataModel in SAPUI5 1.16.4. On using the create() function, as below, I get the attached error.


createEntry: function(sChannelId, sEventId, oData) {

sap.ui.getCore().getModel("COMP").create(

"/COMPONENT", // path

oData, // data

null, // oContext

function(oData, response) { // success

sap.m.MessageToast.show("Success");

},

function(oError) { // error

console.log(oError);

sap.m.MessageToast.show("Error! (Check Log for additional information)", {

duration: 10000

});

});

}

The error occurs before any server communication, it is unrelated to the web service. I get this behavior on any service and any odata model I use. The same error occurs if I use createEntry() and submitChanges() on the odata model.


Is there anybody facing the same issue? Do I call the function incorrect?

Any help is highly appreciated because I don't want to start using ajax and keep the UI up to date by hand.

Best,

Mathias


----


On the stack the entry "sap.ui.controller.onAddTemplatePress (main.controller.js:64)" is related to my code.

  1. 2014-04-16 11:57:43 The following problem occurred: undefined is not a function - sap-ui-core.js:77
    1. usap-ui-core.js:77
    2. fatalsap-ui-core.js:77
    3. sap.ui.model.odata.ODataModel._handleErrorODataModel.js:35
    4. aODataModel.js:32
    5. o.requestdatajs.js:17
    6. cODataModel.js:32
    7. bODataModel.js:32
    8. _ODataModel.js:31
    9. (anonymous function)datajs.js:17
    10. n9datajs.js:17
    11. o.defaultHttpClient.requestdatajs.js:17
    12. D2datajs.js:17
    13. o.requestdatajs.js:17
    14. o.readdatajs.js:17
    15. sap.ui.model.odata.ODataModel.refreshSecurityTokenODataModel.js:31
    16. sap.ui.model.odata.ODataModel._submitChangeODataModel.js:32
    17. sap.ui.model.odata.ODataModel.createODataModel.js:42
    18. sap.ui.controller.onAddTemplatePressmain.controller.js:64
    19. sap.ui.base.EventProvider.fireEventsap-ui-core.js:117
    20. sap.ui.core.Element.fireEventsap-ui-core.js:117
    21. (anonymous function)sap-ui-core.js:117
    22. sap.ui.commons.Button.onclickButton.js:7
    23. sap.ui.core.Element._callEventHandlessap-ui-core.js:117
    24. sap.ui.core.Element._handleEventsap-ui-core.js:117
    25. sap.ui.core.UIArea._handleEventsap-ui-core.js:117
    26. f3sap-ui-core.js:18
    27. Q.event.dispatchsap-ui-core.js:18
    28. i.handle.jsap-ui-core.js:18