根据事务代码找出口

REPORT  ZTCODEUSEREXIT.
*---------------------------------------------------------------------*
*& Report  ZTCODEUSEREXIT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

TABLES : TSTC, "SAP Transaction Codes(SAP 事务代码)
TADIR, "Directory of Repository Objects(资源库对象的目录)
MODSAPT, "SAP Enhancements - Short Texts(SAP增强-短文件)
MODACT, "Modifications(修正)
TRDIR, "System table TRDIR(系统表 TRDIR)
TFDIR, "Function Module(功能模块)
ENLFDIR, "Additional Attributes for Function Modules(功能模块的附加属性)
TSTCT. "Transaction Code Texts(事务代码文本)
DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
SELECTION-SCREEN BEGIN OF BLOCK A01 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
PARAMETERS : P_TCODE LIKE TSTC-TCODE OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK A01.

START-OF-SELECTION.
  SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
  IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'PROG'
    AND OBJ_NAME = TSTC-PGMNA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    IF SY-SUBRC NE 0.
      SELECT SINGLE * FROM TRDIR
      WHERE NAME = TSTC-PGMNA.
      IF TRDIR-SUBC EQ 'F'.
        SELECT SINGLE * FROM TFDIR
        WHERE PNAME = TSTC-PGMNA.
        SELECT SINGLE * FROM ENLFDIR
        WHERE FUNCNAME = TFDIR-FUNCNAME.
        SELECT SINGLE * FROM TADIR
        WHERE PGMID = 'R3TR'
        AND OBJECT = 'FUGR'
        AND OBJ_NAME = ENLFDIR-AREA.
        MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
      ENDIF.
    ENDIF.
    SELECT * FROM TADIR
    INTO TABLE JTAB
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'SMOD'
    AND DEVCLASS = V_DEVCLASS.
    SELECT SINGLE * FROM TSTCT
    WHERE SPRSL EQ SY-LANGU
    AND TCODE EQ P_TCODE.
    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(12) '事务代码 - ',
    13(20) P_TCODE,
    34(10) '功能 - ' ,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
      WRITE:/(95) SY-ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED ON.
      WRITE:/1 SY-VLINE,
      2 'Exit Name',
      21 SY-VLINE ,
      22 'Description',
      95 SY-VLINE.
      WRITE:/(95) SY-ULINE.
      LOOP AT JTAB.
        SELECT SINGLE * FROM MODSAPT
        WHERE SPRSL = SY-LANGU AND
        NAME = JTAB-OBJ_NAME.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        WRITE:/1 SY-VLINE,
        2 JTAB-OBJ_NAME HOTSPOT ON,
        21 SY-VLINE ,
        22 MODSAPT-MODTEXT,
        95 SY-VLINE.
      ENDLOOP.
      WRITE:/(95) SY-ULINE.
      DESCRIBE TABLE JTAB.
      SKIP.
      FORMAT COLOR COL_TOTAL INTENSIFIED ON.
      WRITE:/ '用户出口数量:' , SY-TFILL.
    ELSE.
      FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
      WRITE:/(95) '此TCode没有用户出口!'.
    ENDIF.
  ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(95) '事务代码不存在!'.
  ENDIF.

AT LINE-SELECTION.
  GET CURSOR FIELD FIELD1.
  CHECK FIELD1(4) EQ 'JTAB'.
  SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
  CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

你可能感兴趣的:(60.技术开发,数学建模)