cancel
Showing results for 
Search instead for 
Did you mean: 

How can I show username at the headerItem on HANA SHELL

Former Member
0 Kudos

Hi all,

I have solved this problem before with the below code:

Code:

var username = '';

jQuery.ajax({

          url: "/sap/hana/xs/ide/editor/server/dbinfo.xsjs",

          type: 'GET',

          dataType: "json",

          async:false,

          success: function(data, s, xhr) {

          if (xhr.getResponseHeader("x-sap-login-page")) {

                  return;

              }

              if (data) {

              username = data.user;

              }

          },

      });

But after that I created a new user which haven't got editor privilage so that this code become useless.

Can anybody help me about showing username on shell?


NOTE: I'm using sap.ui.ux3.Shell.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member207744
Contributor
0 Kudos

Hi,

By using shell headeritems, you can assign username.

For more info refer this link Shell Example - SAPUI5 Demo Kit


headerItems: [new sap.ui.commons.TextView({text:UserNameObject,tooltip:"Again Your User Name Object"})],

Former Member
0 Kudos

so how can i get UserNameObject?

former_member207744
Contributor
0 Kudos

I don't have any idea about your code, also you not shared it.

Assuming you are creating shell, after ajax call. if so follow below steps

1. In Ajax call success event, call createShellFunction and pass userNameObject as parameter.

2. Do shell creating logic in createShellFunction and assign userNameObject to shell by using "headerItems"

Former Member
0 Kudos

could you show it with code? only for getting the username part?

former_member207744
Contributor
0 Kudos

Check this link.

http://jsbin.com/kawefu/1/edit?html,js,output

For more info read comments in ajax success event.

Former Member
0 Kudos

I think there is a misunderstanding. Sorry if I'm not clear.

I looked your code you wrote the username by yourself in here:

     userName = "UserName";


My problem is not putting the username at the top. I know how to put it there. But my problem is getting the username from the session. I'm using hana login page. I didn't do anything else for login.