Skip to Content

How to get details of logged in user in SAPUI5

Not a FIORI launchpad application but just in a SAPUI5 application, how can we get the logged in user details ?

The below API provided by SAP is not helpful. Any other options? or Am I doing anything wrong with this API ?

This method MUST be called by the Unified Shell's container only, others MUST call 

sap.ushell.Container.getService("UserInfo"). 

Constructs a new instance of the user information service.

new sap.ushell.services.UserInfo()

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Oct 28, 2019 at 06:26 AM

    Hi Venkata Sunil Naidu Chennam,

    if not in launchpad, then check the below blog:

    https://blogs.sap.com/2015/04/06/how-to-get-username-and-other-login-info-in-sap-ui5-application/

    I would prefer to have an entityset which returns my user details in case if I want some additional details, which the above service in the link might not provide.

    BR,

    Mahesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 28, 2019 at 07:05 AM

    Hi Venkata,

    If you are not launching the application in any of the portal you can use the below link to get the user id currently logged in

    https://blogs.sap.com/2015/04/16/using-the-hcp-user-api-in-web-ide/

    Thanks,

    Drushya

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.