Description : This code snippet gives the list of logged on users in the portal using Webdynpro for JAVA
Required jar files for this code snippet
-> webdynpro_services.jar located at /com.sap.tc.webdynpro.runtime/lib
-> com.sap.security.api.jar located at /com.sap.security/lib
import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
IWDClientUser currentUsers[] = WDClientUser.getClientUsers();
//Displaying the count of logged on users
wdComponentAPI.getMessageManager().reportSuccess("Number of logged on Users in the portal"+currentUsers.length);
wdComponentAPI.getMessageManager().reportSuccess("Number of logged on Users in the portal"+currentUsers.length);
for(int i = 0; i < currentUsers.length; i++)
{
if(currentUsers[i].getSAPUser() != null)
{
//Displaying the logged on users;
wdComponentAPI.getMessageManager().reportSuccess("User - "+currentUsers[i].getSAPUser().getUniqueName());
}
}
{
if(currentUsers[i].getSAPUser() != null)
{
//Displaying the logged on users;
wdComponentAPI.getMessageManager().reportSuccess("User - "+currentUsers[i].getSAPUser().getUniqueName());
}
}
Note: I used reportSuccess statement to show the output, instead you can bind the list of users to a node and show in the Table
Trackback: http://tb.blog.youkuaiyun.com/TrackBack.aspx?PostId=1621197
本文介绍了一段使用Java WebDynpro技术获取当前门户中登录用户的代码片段。该代码利用特定的API来获取所有已登录用户的详细信息,并展示了如何将这些信息输出到控制台。对于希望了解或实现类似功能的开发者来说,这段代码提供了实用的参考。
293

被折叠的 条评论
为什么被折叠?



