Skip to Content
avatar image
Former Member

How to insert data invloving 3 or more entities

In the picture you can see a simplified oData model of my service.

What I want to do is to create an IbaseHeader with Ibase Items (deep insert) and then once it has been created I want to add it as an object to an existing Work Order(Objects tab in the transaction IW32).

How do I do that?

Should I call the create deep entity IbaseHeader + Items from my SAPUI5 app and then on the "success" callback, call update method on the WorkOrderObject entity?

Or should I batch it in LUW and process it together in one go? If yes then how to do that exactly?

If anyone is aware of any FIORI apps doing something similar could you point me towards it?

ibasemodelpic.png (20.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 21, 2017 at 06:00 AM

    I would suggest you to process in batch.

    In Your Gateway Code

    In ChangeSet_Begin, for the mentioned entitites set deferred flag to true.
    In Changeset_Process, collect all the changes and perform Create as well as WorkOrder update.
    In Changeset_End, Commit all.

    Your Gateway Request Body will look like this. (pseudocode). Basically single Batch and single changerequest. If you want sample request bodies, use CORE_SAMPLES test cases in Gateway Client.

    POST IbaseHeader   (this is a deep call)
    PUT WorkOrderObject
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 21, 2017 at 04:00 PM

    it is recommended to use the batch approach.

    Use OData model v2 version which has automatic batch handling and just loop through all the records and call odatamodel create method for all the entities at a time. Then a batch request is sent to backend.

    Now in the backend, assuming it sap abap, implement, changeset begin and changeset process which belongs to APPL interface(not core, check for blogs in google, you will get plenty ). Now in the chageset begin, you need to set cv_defer as abap_true and in the chageset process method, you will find all the records that you have sent from the ui5 batch in an importing internal table.

    Let me know if you need any help.

    Best Regards,

    Add comment
    10|10000 characters needed characters exceeded