Skip to Content

Create Deep Entity is not working when use sapui5

i have create Create Deep Entity in which create entity logic is present and its working fine in gateway client

But i dont know how to consume it in SAP WEB IDE

In sap web IDE i choose CRUD template for this.

but not able to create the entry plz help me regarding this.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 16, 2016 at 08:31 AM

    Hi,

    You have to create an instance of odata model & perform create operation on Model.

    var oModel = new sap.ui.model.odata.ODataModel(gatewayServiceUrl,true);

    Create a JSON type of data

    var globalJSON;

    var Items = []; // Item level Record

    for(var i = 0 ;i <itemreocrd.length;i++)

    {

    // sample code

    var objItems = new Object();

    objItems.key1_Item = 'value1';

    objItems.key2_Item = 'value2';

    Items.push(objItems);

    }

    var oEntry= {};

    oEntry.Key1_Header = 'Value1'.

    oEntry.Key2_Header = 'Value2'.

    oEntry.Items = Items; // contains array of objects.

    try now oModel.create('/collectionName', oEntry, null, function(success){},function(oerror){});

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.