Skip to Content
0
May 18, 2020 at 01:50 PM

issue to get userid on SAP Fiori

950 Views Last edit May 18, 2020 at 01:51 PM 2 rev

hello experts

In sap fiori I am trying to assign the user id in a variable, I have tried the following:
var userinfo = sap.ushell.Container.getService("UserInfo");
this.getView().byId("text1").setText(userinfo.getId()); 

1. but it returns a 'DEFAULT_USER'

2. Also try as follows

var userinfo = sap.ui2.shell.getUser();
this.getView().byId("text1").setText(userinfo.getId());

but this method throws me the following error

typing 'sap.ui2.shell' in console prints the following.

What can I do or what do you recommend in order to print the userid of the current user?

Greetings from Colombia

Attachments

defaultuser.png (2.8 kB)
linea15.png (4.6 kB)
shellconsole.png (3.9 kB)