Skip to Content
Author's profile photo Former Member

Building a tool to monitor who is logged on to an SAP NetWeaver Portal…

One of the most commonly asked questions in the portal forums is how to see who is logged on to a portal. While I’m not completely sure why people want to know this, I decided to try and put together a tool to help. “);


          File uFile = new File(“

          BufferedWriter     o1 = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(uFile,false), “UTF8”));



          } catch (Exception e) {};


     public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)




A bit of testing of the component by POSTing from a static HTML form seems to do the trick, so it’s now time to replace the runtime version of the current SessionManager.jsp. This is done as a portal admin by restarting the archive: System admin -> Support -> Portal Runtime -> Application Console Find And then restart.

Now we need a quick portal component to report on files in \temp with a last stored date within the last 10 seconds and I have a component for listing currently logged on users:





import java.util.Date;

import com.sapportals.portal.prt.component.AbstractPortalComponent;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentResponse;

public class List extends AbstractPortalComponent


    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)


          response.write(“h2. Currently logged on users


          Date now = new Date();

          long l = now.getTime();

          try {

               File dir = new File(“

               File[] fs = dir.listFiles();

               for( int i = 0, ii = fs.length; i < ii; i++ ) {

                    String thisone = fs[i].getName();

                    if (thisone.startsWith(“user_”)) {

                         File f = new File(“

                         BufferedReader i1 = new BufferedReader(new FileReader(f));

                         String line = i1.readLine();


                         long diff = l – new Long(line).longValue();

                         if (diff < 10000) // seconds * 1000
} catch (Exception e) {

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Kenneth Murray
      Kenneth Murray
      To me it seems that such an advanced Enterprise Portal would already have such basic information available. 
      Author's profile photo Former Member
      Former Member
      Blog Post Author
      I agree completely! If the RTMF "knows" who's logged in, then why can't we use this?

      There are a few hassles however... First, do you count people who start portal components directly? These users don't have the ping running. Same with non-portal Java apps - how do we ping their sessions.

      Author's profile photo Thorsten Franz
      Thorsten Franz
      Hi Michael,
      great blog - I learned a lot about the portal. I guess another approach would be to select the users who have a currently active session, i.e. whose session has not timed out. The downside would be that it would display users who closed their browsers 10 minutes ago (how long is the time-out?), the up-side would be that you see those who bypass the portal (no /irj) and maybe just run a Web Dynpro or JSP application on the server. What do you think?
      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Hi Thorsten

      Yeah, tracing this stuff down teaches you a lot about the portal! The main issue with looking at sessions is that they are tied to instances and server nodes, so you'd need some way to collect this info cross server. Also, if someone launches, for example, an iView that starts webgui, then the session would expore, but they're still effecively using the portal..

      With all options there are pluses and minuses!

      Author's profile photo Jawahar Govindaraj
      Jawahar Govindaraj
      That's gr8.