Search This Blog

Monday, May 22

Get Currently Logged in User in SAPUI5 application

Some times to your oData calls, you want to send logged in user as one of the attributes to the call. This is how you can obtain currently logged in user within SAPUI5 application.

var y = "/sap/bc/ui2/start_up";
       var xmlHttp = null;
       xmlHttp = new XMLHttpRequest();
       xmlHttp.onreadystatechange = function() {
       if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
          var oUserData = JSON.parse(xmlHttp.responseText);
             oLoggedinID =;
       }; "GET", y, false );

 oLoggedinID will contain the login id of the person who has logged on.

thank you !
Mohammed Bohra
+91 8898030972

No comments:

Post a Comment