Skip to Content

CRUD operations in SAPUI5

Hello Guys,

I am learning CRUD operations in SAPUI5.I have come across the createEntry() method of the ODATA model,and I am unable to use it.I am looking for an working example to demonstrate the use of the createEntry() method.

Thanks in Advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 30, 2017 at 09:19 AM

    Hi Arjun Biswas,

    createEntry() simply creates a new record for the given path in the OData model with a temporary key and returns the context for that newly created object. It will not automatically create the entity in the backend until you call a submit().

    I think a normal use case for this if you want to create an entity without submitting it to the back-end until a user has entered some additional data. Just imagine a "Product Maintenance" App where the user clicks on a "New Product" button. You would call something like this in the Button Event Handler:

    		var oContext = this.getModel().createEntry("/ProductSet", {
    				properties: oData, //Some optional data you want to set initially 

    Then you would navigate to a product creation view and bind the Context you got from createEntry to that creation view. After the user has entered all necessary data on that creation page he would press a save or cancel button. In these event handlers you would call something like:

                    onSave: function(oEvent) {
    				success: function(oData) {
    				error: function(oData) {
    					//Error message
    		onCancel: function(oEvent) {

    I contrast to that you can call methode create() instead of createEntry(). It will automatically do a back-end call with the new data record (if it is not in a deferred group)

    Hope that helps.


    Add comment
    10|10000 characters needed characters exceeded

    • Hello. I am also interested in this topic. At first thank for your answer Tobias Schnur . What I would like to get to know more is about the CRUD options, this function createEntry() is used only for Creation, what about the other operations, like Update or Delete?

      Thanks in advance.

  • Aug 29, 2017 at 10:40 AM

    CRUD operations are for the oData service. Nothing to do with UI5. In UI5, you will simply call the entity and in the oData the CRUD operatons are executed.

    Check with oData design and development for more on CRUD operations.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 01, 2017 at 11:54 AM

    you can skip createentry for now, it is a bit advanced topic.

    Add comment
    10|10000 characters needed characters exceeded