* This function module can be called from a C program to list the
* active users of the system. The structure ZTEST has to be created
* by se11.
*
FUNCTION Z_TST.
*"----------------------------------------------------------------------
*"*"Local interface:
*"       TABLES
*"              A STRUCTURE  ZTEST
*"----------------------------------------------------------------------
DATA: OPCODE TYPE X VALUE 2.
DATA: BEGIN OF USR_TABL OCCURS 10.
          INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
    ID 'TAB' FIELD USR_TABL-*SYS*.
A-A = 'CLIENT  USER   LAST_ACCESS_TIME  EXT_SESS INT_SESS'.
APPEND A.
CLEAR A.
  LOOP AT USR_TABL.
    A-A+1(3) = USR_TABL-MANDT.
    A-A+8(12) = USR_TABL-BNAME.
    A-A+21(8) = USR_TABL-ZEIT.
    A-A+37(1) = USR_TABL-EXTMODI.
    A-A+46(1) = USR_TABL-INTMODI.
    APPEND A.
  ENDLOOP.
ENDFUNCTION.