Skip to Content
avatar image
Former Member

Change dataSources uri (manifest.json)

Hi, brothers.

I need to change the uri before the call, how can I do it?

manifest.json

"dataSources": {
      "mainService": {
                    "uri": "http://sapmiidev:56500/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=Interrupcoes/TelasPortal/RegistrarInterrupcao/Query/XQry_Interrupcoes_Sel_UI5",
                    "type": "JSON"
			}
		},

Component.js

sap.ui.define([

	"sap/ui/core/UIComponent",

	"sap/ui/Device",

	"mycompany/myapp/model/models",

	"mycompany/myapp/controller/ErrorHandler"

], function(UIComponent, Device, models, ErrorHandler) {

	"use strict";




	return UIComponent.extend("mycompany.myapp.Component", {




		metadata: {

			manifest: "json"

		},

		

		init: function() {

			

			//set param (variable session) in uri.

			this.getMetadata().getManifestEntry("sap.app").dataSources["mainService"].uri = 

				"http://sapmiidev:56500/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=" +

				"Interrupcoes/TelasPortal/RegistrarInterrupcao/Query/XQry_Interrupcoes_Sel_UI5"+

				"&Param.1=xxx" + param;

						

			// call the base component's init function

			UIComponent.prototype.init.apply(this, arguments);

			// initialize the error handler with the component

			this._oErrorHandler = new ErrorHandler(this);




			// set the device model

			this.setModel(models.createDeviceModel(), "device");




			// create the views based on the url/hash

			this.getRouter().initialize();

		}

	});




});


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 08 at 05:27 AM

    I think your url should be

    http://sapmiidev:56500/XMII/IlluminatorOData/

    the rest is composed when you call the odata.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I added and it worked.

      "": {
             "dataSource": "mainService",
             "settings": {
             "disableHeadRequestForToken": true,
             "useBatch": false
          
      
  • Mar 07 at 09:00 PM

    According to the documentation, manifest models are created before component initialization.

    Since you are using a json model, is it an option to use loadData method with the new uri?

    this.getModel().loadData(uri);
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 11 at 12:18 PM

    Pass all the overriding parameters as follows:

    path:'/Rowset(QueryTemplate=\'query\',RowsetId=1)/Row?Param.1=<value>&Param.2=<value>'
    
    Add comment
    10|10000 characters needed characters exceeded