cancel
Showing results for 
Search instead for 
Did you mean: 

How to customize SAP splash template with custom odata service after exporting !!

Former Member
0 Kudos

Hello Folks,

In process of creating better UX and UI oriented prototypes using SAP Splash UX tool , We have an use where the exported template after necessary modifications in Splash editor  to  webide should be connected to our custom odata service to make the prototype to fetch data real time instead of hardcoded.

I found that the out of the splash was a prototype template which is using mock server and database (data.json) , How  remove this mock server thing and connect to our odata service and bind it to the controllers which have already created by Splash tool.

Use case : To create sale order listing (FIORI)

Regards,

Sai.

Accepted Solutions (0)

Answers (1)

Answers (1)

mahesh_z
Participant
0 Kudos

Hello Saikiran,

We need to make some changes in the Component.js but first of all , you need to define a new OData service for your project which you have imported inside WebIDE from Splash.

Once you create OData service, your neo-app.json file will get updated along with the metadata.xml files. After that following changes need to be done inside component.js in order to remove the mockserver.

var mConfig = this.getMetadata().getConfig();

  var sServiceUrl = mConfig.serviceConfig.serviceUrl;

  var bIsMocked = jQuery.sap.getUriParameters().get("responderOn") === "true";

  // Start the mock server for the domain model

  if (bIsMocked) {

  this._startMockServer(sServiceUrl);

  jQuery.sap.require("sap.ui.model.odata.ODataModel");

  jQuery.sap.require("sap.ui.app.MockServer");

  var uri = window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/")) + "/models/";

  var oMockServer = new sap.ui.app.MockServer({

  rootUri: uri

  });

  oMockServer.simulate(uri + "metadata.xml", {

  sMockdataBaseUrl: uri + "sampleData.json",

  bGenerateMissingMockData: true

  });

  if (typeof formulaCalculation !== "undefined") {

  // only use if available - global variable

  formulaCalculation.patchMockServer(oMockServer);

  }

  oMockServer.start();

  }

  var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, {json: true,loadMetadataAsync: true});

  oModel.attachMetadataFailed(function(){

            this.getEventBus().publish("Component", "MetadataFailed");

  },this);

  this.setModel(oModel);

You need to have proper data binding , so i would suggest you verify the spellings of all the entity properties which you have mapped to your controls , if everything goes well , you will be able to get the read time data onto the SPLASH prototypes.

Thanks ,

Mahesh.

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Discussion successfully moved from SMP Developer Center to SAPUI5 Developer Center

Regards,

JK (Moderator)