Skip to Content

Extending SAPUI5 Applications - Purchase Orders

I'm working on an extension, a new view I think is in the method this.getRouter init () attachRoutePatternMatched (this.onRouteMatched, this).; this.getModel gives me error, how you can return to instantiate the service or service to pass a new view in an extension?

Attached files

Component.js.

jQuery.sap.declare("nw.epm.refapps.ext.po.apv.po.tgv.com.Component");

// use the load function for getting the optimized preload file if present

sap.ui.component.load({

  name: "nw.epm.refapps.ext.po.apv",

  // Use the below URL to run the extended application when SAP-delivered application located in a local cloud environment:

  //url: jQuery.sap.getModulePath("nw.epm.refapps.ext.po.apv.po.tgv.com") + "/../../nw.epm.refapps.ext.po.apv/webapp"

  // Use the below url to run the extended application when SAP-delivered application located in a cloud environment:

  url: jQuery.sap.getModulePath("nw.epm.refapps.ext.po.apv.po.tgv.com") +

  "/../orion/file/p1009225trial$P1009225-OrionContent/nw.epm.refapps.ext.po.apv/webapp" // we use a URL relative to our own component

  // extension application is deployed with customer namespace

});

this.nw.epm.refapps.ext.po.apv.Component.extend("nw.epm.refapps.ext.po.apv.po.tgv.com.Component", {

  metadata: {

  version: "1.0",

  config: {},

  customizing: {

  "sap.ui.controllerExtensions": {

  "nw.epm.refapps.ext.po.apv.controller.S3_PurchaseOrderDetails": {

  "controllerName": "nw.epm.refapps.ext.po.apv.po.tgv.com.controller.S3_PurchaseOrderDetailsCustom"

  }

  },

  "sap.ui.viewExtensions": {

  "nw.epm.refapps.ext.po.apv.view.S3_PurchaseOrderDetails": {

  "extensionAfterForm": {

  "className": "sap.ui.core.Fragment",

  "fragmentName": "nw.epm.refapps.ext.po.apv.po.tgv.com.view.S3_PurchaseOrderDetails_extensionAfterFormCustom",

  "type": "XML"

  }

  }

  },

  "sap.ui.viewModifications": {

  "nw.epm.refapps.ext.po.apv.view.S3_PurchaseOrderDetails": {

  "poItemsTable": {

  "visible": false

  }

  }

  },

  "sap.ui.viewReplacements": {

  "nw.epm.refapps.ext.po.apv.view.S3_PurchaseOrderSummary": {

  "viewName": "nw.epm.refapps.ext.po.apv.po.tgv.com.view.S3_PurchaseOrderSummaryCustom",

  "type": "XML"

  }

  }

  },

  routing: {

  routes: [{

  pattern: "",

  name: "vista",

  target: ["master","vista1"]

  }],

  targets: {

  vista1: {

  viewPath: "nw.epm.refapps.ext.po.apv.po.tgv.com.view",

  viewName: "vista1",

  viewLevel: 2

  },

  reemplazo: {

  viewPath: "nw.epm.refapps.ext.po.apv.po.tgv.com.view",

  viewName: "S3_PurchaseOrderSummaryCustom",

  viewLevel: 2

  }

  }

  }

  }

});

Typo was edited by: Michael Appleby

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 20, 2015 at 12:49 AM

    Attached files

    change txt for zip


    sapui5.txt.zip (74.4 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 22, 2015 at 12:52 PM

    problem solved.

    Problem: Create new view, attachRouteMatched error method.

    step solution:

    The method getRouter was generated to bring the global Router.

    step code.

    component.js image attach

    newview.js  - sap.ui.controller sap.ca.scfld.md.controller.BaseDetailController.extend do not use the library, not to'd use case

    sap.ui.controller("nw.epm.refapps.ext.po.apv.po.tgv.com.controller.vista1", {

      onInit: function() {

      this.getRouter().attachRouteMatched(this.onRouteMatched, this);

      },

      getRouter: function() {

      return sap.ui.core.UIComponent.getRouterFor(this);

      },

      onRouteMatched: function(oEvent) {

      var sName = oEvent.getParameter("name");

      if (sName !== "PurchaseOrderDetails") {

      return;

      }

      var oView = this.getView();

      var sPOId = decodeURIComponent(oEvent.getParameter("arguments").POId);

      oView.bindElement("/PurchaseOrders('" + sPOId + "')");

      sap.m.MessageToast.show("ejemplo");

      },

      onVolver: function() {

      window.history.go(-1);

      }

    });

    exthook S3_PurchaseOrderDetailsCustom.controller.js

    sap.ui.controller("nw.epm.refapps.ext.po.apv.po.tgv.com.controller.S3_PurchaseOrderDetailsCustom", {

      extHookOnDataReceived: function(oPurchaseOrder) {

      // Place your hook implementation code here

    //reload the new fields Odata service

      this._oPurchaseOrder = oPurchaseOrder;

      var oView = this.getView();

      oView.bindElement("/PurchaseOrders('" + this._oPurchaseOrder.POId + "')");

      },

      getRouter: function() {

      return sap.ui.core.UIComponent.getRouterFor(this);

      },

      nuevavista: function(oEvent) {

      this.getRouter().navTo("vista", {

      "POId": this._oPurchaseOrder.POId

      });

      }

    });


    Add comment
    10|10000 characters needed characters exceeded