How can i use an odata backend service

  • Christian Kleinschroth
        Has successfully completed the online course Introduction
        Has successfully completed the online course Intermediate (200)
        Has successfully completed the online course Advanced (300)
        Has successfully completed the online course Basics (100)
        Has successfully completed the online course Advanced (310)
        Has successfully completed the online course Advanced (320)
        Has successfully completed the Intermediate Certification
        Has successfully completed the Advanced Certification
      vor 6 Jahren #10036

      In my actual project i want to use the sap leonardo services via odata calls – how can i handle that?

      dcyborra
          vor 6 Jahren #10089
          Up
          0
          Down
          ::

          Hi ck,

          afaik it is as easy as this:

          
          // create a new oData model with your connector and simplifier token
          var oModel = new sap.ui.model.odata.ODataModel("/client/1.0/odata/<your-connector>/?SimplifierToken=<your-token>");
          
          // read the service endpoint
          oModel.read("<your-endpoint>", null, null, true, function(oData, response) {
              // do your work here
          }.bind(this));
          

          Since you can access the simplifier global variables simply by

          
          this.getGlobals().getVar("<your-variable>")
          

          you could do something like

          
          var oModel = new sap.ui.model.odata.ODataModel("/client/1.0/odata/" + this.getGlobals().getVar("odataCon") + /?SimplifierToken=" + this.getGlobals().getVar("token"));
          oModel.read(this.getGlobals().getVar("odataEndpoint"), null, null, true, function(oData, response) {
              // set result as items of your table
              this.setItemModel("Test", "Test_Table1", "items", oData.results);
          }.bind(this));
          
        Ansicht von 2 Beiträgen – 1 bis 2 (von insgesamt 2)

        You must be logged in to reply to this topic.