Skip to Content

How to get UserName and other login info in SAP UI5 application

Hi Everyone,

I am writing this blog to get login info into SAP UI5 application, where you can display User ID, FirstName, LastName, FullName, Email etc… in any of your SAP UI5 Apps.

Here is the sample code where you can fetch all the information into JSON format.

//Get User details once logged in

   //Get User details by using srv;

    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);



    }; “GET”, y, false );


or we can also use JSON Model

oModel = new sap.ui.model.json.JSONModel();


Note: This will only run on SAP UI5 BSP application but not on local SAP UI5 application.

You must be Logged on to comment or reply to a post.