ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 获取当前使用某个TCODE的用户的程序样例

获取当前使用某个TCODE的用户的程序样例

原创 Linux操作系统 作者:niuchao 时间:2019-04-01 11:51:06 0 删除 编辑

REPORT Z_ABAP_SELECT_USER_BY_TCODE .
 TABLES:
             TSTC,
             TSTCT.

DATA OPCODE            TYPE X.
DATA: BEGIN OF USR_TABL OCCURS 10.
        INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.

SELECT-OPTIONS: S_TCODE FOR TSTC-TCODE.

START-OF-SELECTION.

 CLEAR USR_TABL.
 FREE  USR_TABL.

* set the function call mode
  PCODE = 2.

* get list of all users actually logging on
  CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
                   ID 'TAB' FIELD USR_TABL-*SYS*.

  SORT USR_TABL BY BNAME TCODE.

  LOOP AT USR_TABL WHERE TCODE IN S_TCODE.

    SELECT SINGLE TTEXT FROM TSTCT INTO TSTCT-TTEXT
                        WHERE SPRSL = SY-LANGU       AND
                              TCODE = USR_TABL-TCODE.

    TRANSLATE TSTCT-TTEXT TO UPPER CASE.

    WRITE:/
            USR_TABL-BNAME,
            USR_TABL-TCODE,
            TSTCT-TTEXT.

  ENDLOOP.

  IF SY-SUBRC <> 0.
     MESSAGE I001(38) WITH 'NO ENTRIES FOR YOUR SELECTION CRITERIA!'.
  ENDIF.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/166523/viewspace-173521/,如需转载,请注明出处,否则将追究法律责任。

全部评论

注册时间:2004-11-04

  • 博文量
    139
  • 访问量
    111343