Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8078

Re: SAPUI5 display Username

$
0
0

Hy Denise.

 

I´was in same trouble an solved that task in following way.

 

First you have to provide the technical environement.

 

Please ensure you that following components are installed. (Not sure if you need all of them)

UI2_700

UI2_701

UI2_702

UI2_731

UI2_FND

UI2_SRVC

UI5_731

UISAPUI5

UI_INFRA

 

then you can activate the UI2 Services in transaction SICF

/default_host/sap/bc/ui2 and

/default_host/sap/bc/ui5_ui5/ui2

 

next you have to load the required .js files from WebAs into you app.

 

e.g.

<script src="/sap/public/bc/ui2/shell-api/sap/ui2/shell/shell.js"></script><script src="/sap/public/bc/ui2/services/sap/ui2/srvc/error.js"></script><script src="/sap/public/bc/ui2/services/sap/ui2/srvc/utils.js"></script><script src="/sap/public/bc/ui2/shell-api/sap/ui2/shell/startup.js"></script>

 

 

 

 

now you have acces to ui2 shell and user properties.

Please read section 4.2.6.3 Accessing System and User Information in

https://websmp206.sap-ag.de/~sapidb/011000358700000944892012E 

 

 

var oUser = sap.ui2.shell.getUser();                  oUser.load({}, function(){                    var fullName = oUser.getFullName();                    var userID = oUser.getId();            alert('you are loggin in with ' + fullName);                                                        },                  function(sError){                    alert ('user fetching failed ' + sError );                 });

Viele Grüße,

 

Christoph


Viewing all articles
Browse latest Browse all 8078

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>