Blogs

Durairaj Athavan Raja

SAP Logged on Users List Widget
Durairaj Athavan Raja Active Contributor Bronze: 250-499 points
Business Card
Company: Saudi Aramco
Posted on Oct. 10, 2006 01:42 AM in Beginner, Business Server Pages, Widgets

Subscribe.Subscribe
Print. Print
Permalink Permalink
Share
After my first attempt with developing widgets, was looking to develop a useful one and came up with a widget which will show all logged on users in a SAP system. The widget will list out logged on users along with the client to which they are logged on and the transaction that they are using. For this first we are going to develop a small BSP application which will feed the data for this widget.

Let's get started and create the BSP application.

1. Go to transaction SE80 and create a BSP application (Y_WIDGET_DATA).

2. Create one simple page (users.xml a page with flow logic) and clear all the contents from the layout section of the page.

3. Enter the following code in the type definition tab of the page

types: userstype type standard table of uinfo .  

4. Enter the following page attributes

users TYPE USERSTYPE

xml_out TYPE STRING

5. Enter the following code in the OnInitialization event of the BSP page.

refresh users .
call function 'THUSRINFO'
tables
usr_tabl = users .

call transformation (`ID`)
source output = users[]
result xml xml_out.

call method response->if_http_entity~set_cdata
exporting
data = xml_out.

6. Save and activate the page and application.

7. Test the page by right click and choose test on the page (users.xml). You should see the xml output in the browser.

8. Download the widget from this link .

To run this you need to download & install yahoo widget engine.

Check this weblog by Tarun Telang on how to install yahoo widget engine.

How to run this widget.

Once yahoo widget engine is installed, unzip the downloaded SAP_Logged_on_Users.zip and double click on the extracted SAP Logged on Users Widget (SAP Logged on Users.widget) to see the widget.  First time when you run this you will be prompted to enter some values. Fill the same as per details below.

image

WAS Host : <sapapplicationserverhost.domain.com>

WAS Port : <port no>

BSP Application Name: <Name of the BSP application we created in step 1>

BSP Page : <Name of the BSP page we created in step 2>

SAP Client: <client number - 001 on which this will run>

Note: You can get the WAS host, port details from the url of the BSP application.

After entering all of the above click save. Now you will be prompted for user id and password for the SAP system/Client. Enter the same and click OK.

Now you should see list of logged on users along with the transaction code and client like in the picture below.

image

Per view this will show 10 users, click next to view next 10 users.

If you want to develop widgets check out Yahoo! Widgets Workshop, they got some good resources.

Hope you liked this. Looking forward to your comments.

Durairaj Athavan Raja  Active Contributor Bronze: 250-499 points Durairaj Athavan Raja works as Systems Anyalyst with Saudi Aramco and has been involved in SAP development for over 10 years. He is a big fan of SDN.


Comment on this article
Comment on this weblog
Showing messages 1 through 22 of 22.

Titles Only Main Topics Oldest First

  • Logged user at Enterprise Portal
    2010-04-14 02:52:15 Santiago Ruiz Ramos Business Card [Reply]

    Congratulations for this widget, I follow your instructions and it works fine, but, Are there any way to get users from other site? for example, users from Enterprise Portal (EP),
    thanks in advance.
  • It do not work :(
    2008-12-02 07:40:44 bjoern bayerschmidt Business Card [Reply]

    Hi there,
    i have a problem.


    I followd the whole instructions.
    When i open the Widget i give it the WAS HOST Port etc.. then i click "save"


    But the widget do not ask me for user and password.. it takes about 20 - 30 seconds. then the Window were i can give WAS Host Port etc pop up again.. that was it...


    can anybody tell me how this works?


    Thanks
    Bjoern

  • Re: BSP does not executes stand alone
    2008-06-05 12:17:27 Brian Zugel SAP Employee Business Card [Reply]


    Having the same issue as Gaurav Shrivastav. Am getting the error message:


    Switch from current encoding to specified encoding not supported. Error processing resource 'http://tsphl815.phl.sap.corp:8...


    <?xml version="1.0" encoding="utf-16"?>


    Debugging shows that this is NOT happening in the program, but within the WAS.


    Any ideas on how to fix this? I'm very keen on getting this working, as this is a very nice tool.


    Thanks!


    Brian


    • Re: BSP does not executes stand alone
      2008-06-06 23:58:10 Durairaj Athavan Raja Business Card [Reply]

      to avoid this during in
      call transformation (`ID`)
      source output = users[]
      result xml xml_out.


      use the options parameter (without_encoding) to Output the XML without specification of encodings


      Regards
      Raja

      • Re: BSP does not executes stand alone
        2008-06-07 10:19:09 Brian Zugel SAP Employee Business Card [Reply]

        Raja,

        Perfect! I changed your code to the following:

        refresh users.
        call function 'THUSRINFO'
        tables
        usr_tabl = users.


        call transformation (`ID`)
        options XML_HEADER = 'WITHOUT_ENCODING' <===
        source output = users[]
        result xml xml_out.


        call method response->if_http_entity~set_cdata
        exporting
        data = xml_out.


        Works!


        Thanks!


        Brian

  • hi.
    2007-07-18 02:20:17 Jaideep Srinivasan SAP Employee Business Card [Reply]

    This was a wonderful effort by you..and i tried this example..the xml file is displaying in the browser..but not displaying in the browser..am using the abap NW2004s trail version and my host is loaclhost..wht should i give in WAS host..


    this the URL when executing the BSP..
    http://localhost:8000/sap(bD1lbiZjPTAwMA==)/bc/bsp/sap/y_widget_data/users.xml


    thanks
    jaideep

  • question
    2007-02-22 05:50:21 David Rutt Business Card [Reply]

    Could this be adapted to a java standalone portal?
    • question
      2007-02-23 20:29:38 Durairaj Athavan Raja Business Card [Reply]

      yes, but needs little tweaking on the widget code. the widget code is specific to the xml format returned by ABAP engine.


      All we need to do is to get a http service or a webservice which would provide list of logged on users in EP, then with little tweaking on the widget side , this can be adapted to EP.



      Regards
      Raja

  • BSP does not executes stand alone
    2006-11-09 08:05:00 Gaurav Shrivastav SAP Employee Business Card [Reply]

    Hi Raja,
    I tried to execute the BSP page stanalone, just to test if the page fine.
    Following message appears in the browser:
    "The XML page cannot be displayed " followed by
    "Switch from current encoding to specified encoding not supported. Error processing resource 'http://us0302.wdf.sap.corp:500..."
    <?xml version="1.0" encoding="utf-16"?>
    There was no code in the layout.


    I also tried to specify the encoding in the layout of the page explicity, still it issued the same message.


    When I remove the execution of Set_Cdata put some code in layout the page displays.
    Any clues what went wrong..?


    Thanks in advance,


    Regards,
    Gaurav

  • Widget not working
    2006-10-11 08:40:22 Snehal Pandya Business Card [Reply]

    Hello Raja


    I developed this widget and am trying to run this but it does not execute. It just returns back to the input screen.


    Please help.
    Thx
    Snehal Pandya

    • Widget not working
      2006-10-11 23:58:13 Durairaj Athavan Raja Business Card [Reply]

      did you run the BSP application in the browser to see it works fine? did you enter proper values for washost, port, bsp appn name, page and client.


      if any of this value is wrong and the widget cannot connect and get results will throw that input screen. (preferencepane)


      Regards
      Raja

  • Very good work!!!
    2006-10-10 03:50:22 Frank Brackmann Business Card [Reply]

    Hello Raja,


    nice and very very helpful!! If will try to use this kind of widget to display my last Workflow Tasks. But for that i didn't want to take a anonymous BSP Login. I analysed you kon file.
    My questions: Is it possible to add user and password in the widget-preferences and also concatenate it into the URL-String as you have done it for the WAS settings? Are there any BSP parameter available to pass user and password in the URL?


    Thanks for the nice widget!
    Frank

    • Very good work!!!
      2006-10-10 03:55:22 Durairaj Athavan Raja Business Card [Reply]

      Hi Frank,


      Thanks for the comments. yes you can send the uid/pwd as a url string and the format is as below.


      sap/bc/bsp/sap/mybspappn/mypage.htm?sap-client=001&sap-user=<userid>&sap-password=<password>


      Regards
      Raja

      • Very good work!!!
        2006-10-10 05:55:58 Frank Brackmann Business Card [Reply]

        Thanks for fast answer.I didn't recognized that there was a user propt from WAS so it wasn't a anonymous BSP,sorry for my stupid question;-)
        But i will still try the way by passing usr/pwd from the widget preferences through the URL-String,cause i dont like the popup every 30 min(from the polling interval:-))


        Keep on good work!


Showing messages 1 through 22 of 22.