Netweaver Gateway Development

how to implement Deep Insert in SAP backend OData service?

          Deep Insert is used for creating an entity with deep data in an inlined we can send nested data to sap backend and we can update the data accordingly.For example Sales order and line item data.
           In this tutorial we will create a flight in SCARR table and its corresponding flight schedules in SPFLI table using CREATE_DEEP_ENTITY method.We will use our flight service created in earlier tutorial.
  1. Go to tcode SEGW .Now open our flight service and expand service artifacts node and find ****_DPC_EXT class and go to edit mode.Double click to open the class.
  2. From inherited methods node find /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY and right click and press redefine.
  3. Paste below code inside CREATE_DEEP_ENTITY method.You must be familiar with the coding if you had a look at earlier tutorial.We create structure with inline data and assign incoming data to the structure.After that apply some logic and update the tables.

  4. Now we can test  in gateway client( /IWFND/GW_CLIENT).Our service url look like this.http://<host>:<port>/sap/opu/odata/SAP/ZTEST_ODATA_SRV_01/FlightSet('AC')?$expand=ToFlightSchedules.Press execute button.We will get output of flightschedules of flight with carrid AC.

  5. Now press Use as Request button.Now we can see the details in left hand side.Now we will change the flight details to the details of the flight that has to be added to the backend.Iam changing it to details of flight with carrid AI.Change the url to http://<host>:<port>/sap/opu/odata/SAP/ZTEST_ODATA_SRV_01/FlightSet .Change the http method from get to post.and press execute button.If it was success you will see output like below screenshot.
Now you can check the tables SCARR and SPFLI.It will be updated with details of new flight AI.

If you enjoyed this post, I’d be grateful if you’d help it spread by sharing.Thank you! See you soon


  1. Its very helpfull thanks a lot :)

    1. Thanks for the feedback.You are welcome.

  2. Your work is not in vain. thank you very much.

  3. Replies
    1. Hi Krzysztof,
      Its is similar to create operation.Create opertaion.
      The difference is only in the entry object.
      sample code

      onCreateDeep: function(oEvent) {
      var oEntry = {
      Carrid: "",
      Carrname: "",
      Currcode: "",
      Url: "",
      ToFlightSchedules: [{
      Carrid: "",
      Connid: "",
      Countryfr: "",
      Cityfrom: "",
      Airpfrom: "",
      Countryto: "",
      Cityto: "",
      Airpto: ""

      var oModel = this.getView().getModel();
      oModel.create("/FlightSet", oEntry, {
      method: "POST",
      success: function(data) {
      error: function(e) {



Powered by Blogger.