This Space has blogs on various topics in the field of SAP. These blogs point out solutions to various technical and functional issues that consultants face during implementation or support of SAP Projects. Readers/followers are welcome to contribute to this space by emailing your content at bohra.mohammadi@gmail.com. You will be rewarded according to the topic/number of words/complexity of the topic/issue which are you addressing in your 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 = oUserData.id;
}
};
xmlHttp.open( "GET", y, false );
xmlHttp.send(null);
oLoggedinID will contain the login id of the person who has logged on.
thank you !
Mohammed Bohra
+91 8898030972
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 = oUserData.id;
}
};
xmlHttp.open( "GET", y, false );
xmlHttp.send(null);
oLoggedinID will contain the login id of the person who has logged on.
thank you !
Mohammed Bohra
+91 8898030972
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
You are welcome to express your views here...