Skip to Content

How to call a second odata service in a standard fiori application extension?

I have to extend the standard PO approval Fiori application and I have display a report and some graphs in the item details page by passing the material number, plant to the SAP system and retrieving the data based on it. I have created a second OData service containing the methods for the extensions. so how do I now call the OData service in the controller and how do I pass the material number from the standard application to it???

code to call second service in onInit : function()

var sServiceURL = "/sap/opu/odata/sap/MM_PO_APPROVAL_SRV_01/";
  var oModel_mock = new sap.ui.model.json.JSONModel();
  var oModel = new sap.ui.model.odata.v2.ODataModel(sServiceURL);
  var sPath = "get_Quote_comparison(matnr='00000000000200001')/Set";
  oModel.read(sPath, {
   success: function (odata, response) {
    debugger;
    oModel_mock.setProperty("idQuoteCompareTable", odata);
    oView.setModel(oModel_mock);
    sap.m.MessageToast.show("Data read");
   },
   error: function (e) {
    debugger;
    var oModelBlank = "Error";
    oModel_mock.setProperty("idQuoteCompareTable", oModelBlank);
    oView.setModel(oModel_mock);
   }
  });

table code

<Table id="table1" noDataText="No Data" item="{path : '/get_Quote_comparisonSet'}">
        <items>
         <ColumnListItem id="item2" type="Active">
          <cells>
           <Text text="{prevpo}"/>
           <Text text="{budget}"/>
           <Text text="{rfq1}"/>
           <Text text="{rfq2}"/>
           <Text text="{rfq3}"/>
          </cells>
         </ColumnListItem>
        </items>
        <columns>
         <Column id="column01">
          <header>
           <Label id="idQC2"/>
          </header>
         </Column>
         <Column id="column02">
          <header>
           <Label id="idPrevPo2" text="Previous PO"/>
          </header>
         </Column>
         <Column id="column03">
          <header>
           <Label id="idRFQ12" text="RFQ1"/>
          </header>
         </Column>
         <Column id="column04">
          <header>
           <Label id="idRFQ22" text="RFQ2"/>
          </header>
         </Column>
         <Column id="column05">
          <header>
           <Label id="idRFQ32" text="RFQ3"/>
          </header>
         </Column>
         <Column id="column06">
          <header>
           <Label id="idRFQ42" text="RFQ4"/>
          </header>
         </Column>
         <Column id="column07">
          <header>
           <Label id="idRFQ52" text="RFQ5"/>
          </header>
         </Column>
        </columns>
       </Table>

please Help!!….

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

0 Answers