on 04-19-2017 7:38 PM
I an trying get the logged Sap Gateway logged user.
The code bellow is in my controler
onInit : function (evt) {
var oUserData;
var y = "/sap/bc/ui2/start_up";
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
oUserData = JSON.parse(xmlHttp.responseText);
alert(oUserData);
}else{alert("fail");}
};
xmlHttp.open("GET", y, false);
xmlHttp.send(null);
},
When I run my application in eclipse it's also show the alert "fail". What's happen? It's wrong?
Now it's working
Below is my new code
onInit : function (evt) {
var oUserData;
var y = "http://<your_gateway_system>:<port>/sap/bc/ui2/start_up";
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
oUserData = JSON.parse(xmlHttp.responseText);
alert(oUserData["fullName"]);
}
};
xmlHttp.open("GET", y, false);
xmlHttp.send(null);
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ruben,
Take off the - else{alert("fail");} and try .
Regards
Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.