Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to Transfer input field from one view.js to other in SAPUI5

Hi expert,

I am trying to pass input value from one view to  another like this

**Firstview:-**

  oFooter.addContent(new sap.m.Button("b1", {

  text   : "Execute",

  icon   : "sap-icon://display",

  styled : false,

  press  : function() { 

  var In_obj = sap.ui.getCore().byId('inobj').getValue();

  var Ins_obj = sap.ui.getCore().byId('insobj').getValue();

  var In_exid = sap.ui.getCore().byId('exid').getValue();

  var In_dp1 = sap.ui.getCore().byId('DP1').getValue();

  var In_dp2 = sap.ui.getCore().byId('DP2').getValue();

  var In_usr = sap.ui.getCore().byId('User').getValue();

  var In_tcd = sap.ui.getCore().byId('tcode').getValue();

  var In_prg = sap.ui.getCore().byId('prog').getValue();

  app.to("page2", {

  Input_obj : In_obj,

  Input_sobj : Ins_obj,

  Input_exid : In_exid,

  Input_dp1 : In_dp1,

  Input_dp2 : In_dp2,

  Input_usr : In_usr,

  Input_tcd : In_tcd,

  Input_prg : In_prg,

  });

  }

  }));

**Secondview.controller.js:-**

  onInit : function() {

  alert("second page init"  );

       view.addEventDelegate({

       onBeforeShow: function(evt) {

       var idToRetrieve = evt.data.Input_obj;

       Input_obj = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_sobj;

       Input_sobj = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_exid;

       Input_exid = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_dp1;

       Input_dp1 = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_dp2;

       Input_dp2 = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_usr;

       Input_usr = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_tcd;

       Input_tcd = idToRetrieve.getValue();

       var idToRetrieve = evt.data.Input_prg;

       Input_prg = idToRetrieve.getValue();

       alert( Input_obj );

     console.log( Input_obj);

     }});

  },

now I don't know how to use variables(Input_obj ,Input_sobj .....) in Secondview.js(view).Please give me some suitable suggestion.

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question