Skip to Content
Former Member
Jul 31, 2014 at 04:15 AM

Passing Parameters between two pages in SAPUI5



In my SAPUI5 Application, i have two views, first one is Login page & second one is a Master-Detail page displaying PurchaseOrders.

The Login page & Master detail are working fine as two separate pages. But the actual requirement is to pass the Login information from Login page to Masterdetail page.

We validate the user role & access & then based on these values we take the user to the second page.

For this validation we hit ODATA service in Login page's Controller like below:

I hit the service & i get the RelCode & RelGroup from the response. I need to pass these values to my second page. I have gone through various forums & apis & found that the new functionality "subscribe" & "channel" will help pass data between pages. But i couldn't get this implementation right, with very few references available.

It would be of great help if anyone can suggest a logic to pass data between pages... Appreciate any assistance!!


login_validate : function(oEvent)





var username_value = $("#username_value_id").val();

alert('username_value '+username_value);

var password_value = $("#password_value_id").val();

alert('password_value '+password_value);

var login_url = "proxy/http/'"+username_value+"',Password='"+password_value+"')";

var login_Odatamodel = new sap.ui.model.odata.ODataModel(login_url, "dev_sde", "28aug@2013");


var RelCode = "";

var RelGroup = "";


requestUri : login_url,

method : "GET",

user: username_value,

password: password_value,

headers :


"X-Requested-With" : "XMLHttpRequest",

"Content-Type": "application/json; charset=utf-8",

"DataServiceVersion" : "2.0",

"X-CSRF-Token" : "Fetch"



function(data, response)


RelCode = data.RelCode;

RelGroup = data.RelGroup;

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

var params = {param1: RelCode};

//to subscribe


//to publish data between pages





alert('Error Caught '+err.message);






alert('error '+error.message);



Loginpageview.js: On Logon, the page navigation is set to 2nd page. This is where i need to pass those parameters as described above.

Logon_btn = new sap.ui.commons.Button(



text: "Login",

tooltip : "Login Here",

press : function(evt)


if($("#username_value_id").val().length != 0 && $("#password_value_id").val().length != 0)



var app = sap.ui.getCore().byId("po_id");"idPurchaseOrder1");





alert("Please Enter Valid Credentials.");





An update to my question:

I am able to subscribe & publish the data to the second page. But i now need to know how i can set this in my ODATA URL of master/detail page:

The code below shows the RelCode i retrieved from login page's response:

createContent : function(oController) {

var RelCode = "";

DetailHome = function(sChannelId, sEventId, oData){

//var RelGroup = "";

RelCode = oData.param1;

alert('RelCode in PO --'+RelCode);



The above RelCode need to be passed to the Master page's service URL..

var masterServiceUrl = "proxy/http/'RG'â„ślCode='"+RelCode+"'";