Tips and Tricks for the ABAP® Programming Language

Y9030025 – Show all actually logged on SAP users

This reports shows all actually logged on user.

ABAP-Source-Code

You can copy and paste the source code directly into the ABAP-Workbench.

REPORT Y9030025 LINE-SIZE 38.
*
**********************         HEADER                    **************
*
* Copyright (c) 1999 by Stefan Riede-Seifert
*               71034 Boeblingen.
*
*     You can use or modify this report for your own work as long
*               as you don't try to sell or republish it.
*      In no event will the author be liable for indirect, special,
*        Incidental, or consequental damages (if any) arising out of
*                       the use of this report.
*//////////////////////////////////////////////////////////////////////*

* Local declarations.
  data:
    lt_usr      like uinfo occurs 10 with header line,
    lt_usr_tabl like uinfo occurs 10 with header line,
    lv_opcode   type x.

* Set operations code.
  LV_OPCODE = 2.

* Call kernel.
  call 'ThUsrInfo' id 'OPCODE'  field lv_opcode
                   id 'TAB'     field lt_usr_tabl-*sys*.

* Rearrange and sort.
  loop at lt_usr_tabl-*sys* into lt_usr_tabl.
    move lt_usr_tabl-bname to lt_usr-bname.
    collect lt_usr.
  endloop.
  sort lt_usr.

* Output.
  loop at lt_usr.
    write / lt_usr-bname.
  endloop.