Skip to Content

Session SAPUI5

Mar 28, 2017 at 06:00 PM


avatar image

I have a SAPUI5 application on my SAP Portal. I need to get the SAP Portal user logon on my application SAPUI5. How can I do it?

sap | SAPUI5 | ui5
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jun Wu Mar 28, 2017 at 07:38 PM

is ui5 deployed to nw portal? if yes, just set the web xml

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Yes the ui5 was deploy to nw portal.
Can you show my an example, how can I set it in the web xml?

Arthur Silva Apr 14, 2017 at 02:14 PM


I faced the same issue a couple of days ago. I presume that you're using NWDS to develop, and using a SAPUI5 web based project. To get the logged user from SAP Portal in your SAPUI5 project, you should use class, which is a interface of user settings. It is also possible to get specific details by using this class, just like name, address, roles, and so on.

I suppose your using servlet to update your model. For the first servlet call (or for each model update), try the below code:

IUser user = UMFactory.getAuthenticator().getLoggedInUser(request, response);
if (null == user) {
// forces username
UMFactory.getAuthenticator().forceLoggedInUser(request, response);
String userName = request.getRemoteUser();

Documentation might be found here

Arthur Silva

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Arthur,

I have to put this code in my controller?



This code need to be placed on the servlet (java based), more specific in doGet method.

Arthur Silva