Skip to Content
Technical Articles

Assigning Dynamically changing Profile Pictures and User names based on User in SAP Design Studio – Part 2

Introduction:

In the first part of my blog, I have mentioned how to change the Profile Picture dynamically. In this blog, I have mentioned how to change the usernames based on the user who logs in to access the Dashboard developed in SAP Design Studio.

I would like to recap the requirement here. We got a requirement from one of my customers that we need to assign profile picture in SAP Design Studio based on users. The user logs in using SAP BI Launchpad. So, based on the user we need to assign the profile pictures and usernames to the users dynamically. Here, I have used a simple method to assign the Profile Picture and Username to a single user. By repeating the condition used here, you can add the profile pictures and user names of users as required.

Main Problem:

In SAP Design studio, there is no component to fetch the username directly. To achieve this functionality, we need to find another way by fetching the username from the Launchpad. We can now find the solution for this.

Solution:

In this blog, I’ve explained a method to achieve the functionality of using dynamic usernames for users by using the Text box component. The username would be fetched from the BI launchpad and based on the User ID, the username of the user changes dynamically.

To achieve this, follow the steps mentioned below:

1. Add a text box as mentioned in the below Screenshot to the dashboard.

 

2. Now, go to On-Startup and write the code as shown in the below screenshot:

if(DS_1.getInfo().user == “Administrator”){

USER_TEXT.setText(“Ms. ABC, Senior Analyst “);

}else{

USER_TEXT.setText(“Welcome, ” + DS_1.getInfo().user);

}

In the above code, DS_1 is the data source, from where we are fetching the name of the user. Here, we have mentioned the name of the user and the user’s designation and have assigned it to the text box named, USER_TEXT. Similarly, we can also assign a text that appears as default.

After typing the above, click on ‘OK’.

3. Now, go to BI launchpad and execute the dashboard.

4. In case if we remove the above code, you can notice that the name disappears.

5. So, from the above steps you could see how the username changes according to the User who accesses the dashboard via BI launchpad. We can similarly set up names for several users by using the nested if condition.

Conclusion:

So, in this blog, we have achieved the condition of dynamic user name assignment to users based on their login names into the BI launchpad.

Reference:

  • https://blogs.sap.com/2013/12/24/how-to-embed-images-inside-of-a-design-studio-app-without-uploading-to-server/

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.