on 2024 Jan 08 1:13 PM
Hello Experts
I Have tried below blog and was successfully able to get the login details.
sap-approuter-user-api-service
The question here is , if i create a simple Custom Fiori application(managed approuter) , how do i get logged in user details in controller.?
Regards
Godson
Request clarification before answering.
Very same like you described, just make the call
onShowCurrentUser: function() {
var oModel = new sap.ui.model.odata.v2.ODataModel("/path/to/your/service");
this.getView().setModel(oModel);
oModel.read("/CurrentUser", {
success: function(oData) {
// Process the response data, e.g., display in a control
var currentUserDetails = oData.results[0]; // Assuming the first result is the user data
// Update your view/control with currentUserDetails
},
error: function(oError) {
// Handle errors, e.g., user not logged in or service not reachable
}
});
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in your controller, make a ajax call to get the data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
53 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.