*&---------------------------------------------------------------------*
*& Report ZEXIT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZEXIT_LZX.
TABLES: TSTC , "SAPTransaction Codes
TADIR , " Directory of Repository Objects
MODSAPT , " SAP Enhancements - Short Texts
SXS_ATTRT, " SAPBADI- short text
MODACT , " Modifications
TRDIR , " System table TRDIR
TFDIR , " Function Module
ENLFDIR , " Additional Attributes for Function Modules
TSTCT . " Transaction Code Texts
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*
DATA: JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA: FIELD1(30).
DATA: V_DEVCLASS LIKE TADIR-DEVCLASS.
DATA: OBJECT LIKE TADIR-OBJECT.
DATA: BDCDATA_WA TYPE BDCDATA,
BDCDATA_TAB TYPE TABLE OF BDCDATA.
DATA: OPT TYPE CTU_PARAMS.
DATA: L_NAME LIKE MODSAP-NAME,
L_MEMBER LIKE MODSAP-MEMBER,
L_STEXT LIKE TFTIT-STEXT.
*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK A01 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
PARAMETERS: P_TCODE LIKE TSTC-TCODE OBLIGATORY.
SELECTION-SCREEN SKIP.
PARAMETERS: EXIT RADIOBUTTON GROUP 1 DEFAULT 'X',
BADI RADIOBUTTON GROUP 1.
SELECTION-SCREEN END OF BLOCK A01.
DEFINE BDC_PROGRAM.
CLEAR BDCDATA_WA.
BDCDATA_WA-PROGRAM = &1.
BDCDATA_WA-DYNPRO = &2.
BDCDATA_WA-DYNBEGIN = &3.
APPEND BDCDATA_WA TO BDCDATA_TAB.
END-OF-DEFINITION.
DEFINE BDC_DETAIL.
CLEAR BDCDATA_WA.
BDCDATA_WA-FNAM = &1.
BDCDATA_WA-FVAL = &2.
APPEND BDCDATA_WA TO BDCDATA_TAB.
END-OF-DEFINITION.
*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*
START-OF-SELECTION.
IF EXIT = 'X'.
OBJECT = 'SMOD'. " User-exit!
ELSE.
OBJECT = 'SXSD'. " BADI!
ENDIF.
* Validate Transaction Code:
SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
* Find Repository Objects for transaction code:
IF SY-SUBRC EQ 0. " IF 1
SELECT SINGLE * FROM TADIR WHERE PGMID = 'R3TR'
AND OBJECT = 'PROG'
AND OBJ_NAME = TSTC-PGMNA. " Program name!
* 找到事务代码开发类
MOVE: TADIR-DEVCLASS TO V_DEVCLASS. " Package
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.
* Find SAP Modifactions:
SELECT * FROM TADIR INTO TABLE JTAB WHERE PGMID = 'R3TR'
AND OBJECT = 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: /(19) 'Transaction Code - ',
20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL. " IF 2
WRITE: /(100) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* Exit:
IF EXIT = 'X'.
WRITE: /1 SY-VLINE,
2 'Exit Name',
22 SY-VLINE ,
23 'Description',
100 SY-VLINE.
* BADI:
ELSE.
WRITE: /1 SY-VLINE,
2 'BADI Name',
22 SY-VLINE ,
23 'Description',
100 SY-VLINE.
ENDIF.
WRITE:/(100) SY-ULINE.
LOOP AT JTAB.
* EXIT:
IF EXIT = 'X'.
SELECT SINGLE * FROM MODSAPT WHERE SPRSL = SY-LANGU
AND NAME = JTAB-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE: /1 SY-VLINE,
2 JTAB-OBJ_NAME HOTSPOT ON,
22 SY-VLINE ,
23 MODSAPT-MODTEXT,
100 SY-VLINE.
CLEAR: L_NAME,
L_MEMBER,
L_STEXT.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
SELECT MODSAP~NAME
MODSAP~MEMBER
INTO (L_NAME,L_MEMBER)
FROM MODSAP
WHERE MODSAP~NAME = JTAB-OBJ_NAME
AND MODSAP~TYP <> ''
.
IF L_MEMBER IS NOT INITIAL.
SELECT SINGLE TFTIT~STEXT
INTO L_STEXT
FROM TFTIT
WHERE TFTIT~FUNCNAME = L_MEMBER
.
ENDIF.
WRITE: /1 SY-VLINE,
5 L_MEMBER,
22 SY-VLINE ,
23 L_STEXT,
100 SY-VLINE.
ENDSELECT.
* BADI:
ELSE.
SELECT SINGLE * FROM SXS_ATTRT WHERE SPRSL = SY-LANGU
AND EXIT_NAME = JTAB-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE: /1 SY-VLINE,
2 JTAB-OBJ_NAME HOTSPOT ON,
22 SY-VLINE ,
23 SXS_ATTRT-TEXT,
100 SY-VLINE.
ENDIF.
ENDLOOP.
WRITE: /(100) SY-ULINE.
DESCRIBE TABLE JTAB.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
IF EXIT = 'X'.
WRITE: / 'No of Exits:', SY-TFILL.
ELSE.
WRITE: / 'No of BADIs:', SY-TFILL.
ENDIF.
ELSE. " IF 2
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE: /(100) 'No User Exit exists'.
ENDIF. " IF 2
ELSE. " IF 1
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE: /(100) 'Transaction Code Does Not Exist'.
ENDIF. " IF 1
* Take the user to SMOD for the Exit that was selected:
AT LINE-SELECTION.
GET CURSOR FIELD FIELD1.
CHECK FIELD1(4) EQ 'JTAB'.
* For exit:
IF EXIT = 'X'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
* For BADI:
ELSE.
CLEAR: BDCDATA_WA, BDCDATA_TAB[].
BDC_PROGRAM
'SAPLSEXO' '0100' 'X'.
BDC_DETAIL
'BDC_CURSOR' 'G_IS_BADI'.
BDC_DETAIL
'BDC_OKCODE' '=ISSPOT'.
BDC_DETAIL
'G_IS_BADI' 'X'.
BDC_PROGRAM
'SAPLSEXO' '0100' 'X'.
BDC_DETAIL
'BDC_CURSOR' 'G_BADINAME'.
BDC_DETAIL
'BDC_OKCODE' '=SHOW'.
BDC_DETAIL
'G_BADINAME' SY-LISEL+1(20).
OPT
-DISMODE = 'E'.
OPT
-DEFSIZE = 'X'.
CALL TRANSACTION 'SE18' USING BDCDATA_TAB OPTIONS FROM OPT.
ENDIF.