Skip to Content
author's profile photo
Former Member

FM to logoff user sessions TH_DELETE_USER

Hi,

We have a requirement to develop a report program which should log off all the sessions of a specific user. We tried to use the standard FM 'TH_DELETE_USER' for this functionality but we are getting 'AUTHORITY_ERROR' when we execute this FM.

If anybody has worked on this FM and knows how to use the FM to satisfy the requirement please let us know or any other suggestions which can help us in loging off the users will be of great help.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Posted on Apr 27, 2011 at 12:02 PM

    Hi,

    first you need a user who has this administration authorities.

    Then you have to get some informations about servers and users, e.g.:

    *    Get server list
    call function 'RFC_GET_LOCAL_DESTINATIONS'
        tables
          localdest     = xt_server
        exceptions
          not_available = 1
          others        = 2.
                                                                                    check sy-subrc          eq  0.
                                                                                    refresh                     xt_users.
                                                                                    loop                    at  xt_server.
        refresh                   xt_usrvr.
                                                                                    call function 'THUSRINFO'
          destination xt_server
          tables
            usr_tabl = xt_usrvr
          exceptions
            others   = 4.
        if  sy-subrc          eq  0.
          loop                at  xt_usrvr.
            if xt_usrvr-bname in  xp_uname.
              xt_users-bname  =  xt_usrvr-bname.
              xt_users-tid    =  xt_usrvr-tid.
              xt_users-apserver  =  xt_server.
              append             xt_users.
            endif.
          endloop.
        else.
          message  w999(zz) with  text-m00
                                  xt_server.
        endif.
      endloop.
                                                                                    *    SORT list
      sort                        xt_users
                              by  bname
                                  apserver
                                  tid.
                                                                                    *    delete duplicates
      delete  adjacent duplicates from xt_users
                       comparing  bname
                                  apserver.

    At least you have to logoff the user

    call function 'TH_DELETE_USER'
        destination xt_users-apserver
        exporting
          user            = xt_users-bname
          client          = sy-mandt
        exceptions
          authority_error = 1
          others          = 2.

    Regards,

    Klaus

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Apr 27, 2011 at 12:03 PM

    Why not speak to your security admin about the "authority error". It seems rather obvious that the user executing the process doesn't have the necessary authorization to perform the "delete".

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      We have copied SM04 and made it as a ZSM04 to satisfy the above requirement. The Auth issue was resolved by Basis team by adding suitable security roles.