cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch multiple Detail List item by passing one input value from masterlist using odata service

Former Member
0 Kudos

Hello guys,

I'm trying to build an UI5 application in which there is 1 to M cardinality. By using the below code in detail.controller.js, I'm able to fetch only the first row of my detail set.

detail.controller.js


onInit : function() {

  /*

   * this.getView().addEventDelegate({ onBeforeShow :

   * jQuery.proxy(function(oEvt) { this.onBeforeShow(oEvt); }, this) });

   */

  var bus = sap.ui.getCore().getEventBus();

  bus.subscribe("app", "RefreshDetail", this._refresh, this);

},

_refresh : function(channelId, eventId, data) {

  var Bomnumber = data.Bomnumber;

   this.getView().byId("bomnumber").getValue(Bomnumber);

  var path = "/detailppSet('" + Bomnumber + "')";

  this.byId("detail").bindElement(path);

  this.byId("title").bindElement(path);

},

I need help to fetch multiple item details from detail set by giving one input from master set using odata service

Looking forward for your reply.

Thank you.

Anto.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Can somebody please help me with a solution...I'm not able to go ahead with the application development as per the requirements given.

Looking forward for your reply.

Regards,

Anto.

Former Member
0 Kudos

Hi Guys,

I have figured it out to get the detail list item by passing one input item from master list. I've posted the code for the following below.

Detail.controller.js

onInit : function() {

  /*

  * this.getView().addEventDelegate({ onBeforeShow :

  * jQuery.proxy(function(oEvt) { this.onBeforeShow(oEvt); }, this) });

  */

  var bus = sap.ui.getCore().getEventBus();

  bus.subscribe("app", "RefreshDetail", this._refresh, this);

  var oModel = new sap.ui.model.odata.ODataModel(

  "/sap/opu/odata/SAP/ZPPBOM_ODATA1_SRV_01",

  true);

  var oTable = new sap.m.Table("detail1");

   oTable.setModel(oModel);

  },

  _refresh : function(channelId, eventId, data) {

  var Bomnumber = data.Bomnumber;

  // this.byId("xyz").bindElement(Bomnumber);

  var oFilter = (new sap.ui.model.Filter("Stlnr",

  sap.ui.model.FilterOperator.EQ, Bomnumber));

  //this.getView().byId("detail").getBinding("items").filter(oFilter);

  this.byId("detail1").getBinding("items").filter(oFilter);

  this.byId("stlnr").setText(Bomnumber);

  },

give the table an id and bind it to the controller.

Answers (0)