Posted: Tue Sep 04, 2007 5:15 pm Post subject: Listing UserExits in Transactions
Applies To:
SAP 4.6C and SAP SAP 4.7 Enterprise Edition
Summary
To display and list out the Userexits for a given transaction.
By: Rajasekhar Dinavahi
Company: Intelligroup Asia
Date: 15 Nov 2005
Code:
*&---------------------------------------------------------------------*
*& Report Z_USEREXIT_DISPLAY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* Title : Display UserExits
* Object Owner : RAJ
* Functional Consultant :
* Technical Consultant : Mr. Rajasekhar Dinavahi
* Date : 15-Nov-2005
* Transport Request No :
*----------------------------------------------------------------------*
* Modification Log *
*----------------------------------------------------------------------*
* ModNo Date Consultant Description of Change(s) *
*----------------------------------------------------------------------*
* *
************************************************************************
REPORT Z_USEREXIT_DISPLAY
NO STANDARD PAGE HEADING
LINE-SIZE 200
MESSAGE-ID ZZ.
*&---------------------------------------------------------------------*
* T A B L E D E C L A R A T I O N S *
*&---------------------------------------------------------------------*
TABLES: TFTIT,
E071,
E070.
*&---------------------------------------------------------------------*
* S T R U C T U R E D E C L A R A T I O N S *
*&---------------------------------------------------------------------*
TYPES: BEGIN OF X_TSTC,
TCODE TYPE TCODE,
PGMNA TYPE PROGRAM_ID,
END OF X_TSTC.
TYPES: BEGIN OF X_TADIR,
OBJ_NAME TYPE SOBJ_NAME,
DEVCLASS TYPE DEVCLASS,
END OF X_TADIR.
TYPES: BEGIN OF X_SLOG,
OBJ_NAME TYPE SOBJ_NAME,
END OF X_SLOG.
TYPES: BEGIN OF X_FINAL,
NAME TYPE SMODNAME,
MEMBER TYPE MODMEMBER,
INCLUDE(15), "Include name
END OF X_FINAL.
*&---------------------------------------------------------------------*
* I N T E R N A L T A B L E D E C L A R A T I O N S *
*&---------------------------------------------------------------------*
DATA: IT_TSTC TYPE STANDARD TABLE OF X_TSTC WITH HEADER LINE.
DATA: IT_TADIR TYPE STANDARD TABLE OF X_TADIR WITH HEADER LINE.
DATA: IT_JTAB TYPE STANDARD TABLE OF X_SLOG WITH HEADER LINE.
DATA: IT_FINAL TYPE STANDARD TABLE OF X_FINAL WITH HEADER LINE.
*&---------------------------------------------------------------------*
* V A R I A B L E S D E C L A R A T I O N S *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
* U S E R I N P U T S S C R E E N *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
* S E L E C T I O N S C R E E N *
*&---------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-T01.
PARAMETERS: P_TCODE LIKE TSTC-TCODE OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK01.
*&---------------------------------------------------------------------*
* S t a r t o f S e l e c t i o n *
*&---------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM GET_TCODES. "Get Tcodes
PERFORM GET_OBJECTS. "Get Objects
*&---------------------------------------------------------------------*
* E n d o f S e l e c t i o n *
*&---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM DISPLAY_RESULTS. "Display Results
*&---------------------------------------------------------------------*
*& Form get_tcodes
*&---------------------------------------------------------------------*
* Get Tcodes
*----------------------------------------------------------------------*
FORM GET_TCODES.
SELECT TCODE
PGMNA
INTO TABLE IT_TSTC
FROM TSTC
WHERE TCODE = P_TCODE.
IF SY-SUBRC = 0.
SORT IT_TSTC BY TCODE.
ENDIF.
ENDFORM. " get_tcodes
*&---------------------------------------------------------------------*
*& Form get_objects
*&---------------------------------------------------------------------*
* Get Objects
*----------------------------------------------------------------------*
FORM GET_OBJECTS.
DATA: L_FNAME LIKE RS38L-NAME,
L_GROUP LIKE RS38L-AREA,
L_INCLUDE LIKE RS38L-INCLUDE,
L_NAMESPACE LIKE RS38L-NAMESPACE,
L_STR_AREA LIKE RS38L-STR_AREA.
DATA: V_INCLUDE LIKE RODIOBJ-IOBJNM.
DATA: E_T_INCLUDE TYPE STANDARD TABLE OF ABAPSOURCE WITH HEADER
LINE.
DATA: L_LINE TYPE STRING,
L_TABIX LIKE SY-TABIX.
SELECT OBJ_NAME
DEVCLASS
INTO TABLE IT_TADIR
FROM TADIR FOR ALL ENTRIES IN IT_TSTC
WHERE PGMID = 'R3TR' AND
OBJECT = 'PROG' AND
OBJ_NAME = IT_TSTC-PGMNA.
IF SY-SUBRC = 0.
SORT IT_TADIR BY OBJ_NAME DEVCLASS.
SELECT OBJ_NAME
INTO TABLE IT_JTAB
FROM TADIR FOR ALL ENTRIES IN IT_TADIR
WHERE PGMID = 'R3TR' AND
OBJECT = 'SMOD' AND
DEVCLASS = IT_TADIR-DEVCLASS.
IF SY-SUBRC = 0.
SORT IT_JTAB BY OBJ_NAME.
ENDIF.
ENDIF.
ENDIF.
*- Get UserExit names
LOOP AT IT_JTAB.
SELECT NAME
MEMBER
INTO (IT_FINAL-NAME, IT_FINAL-MEMBER)
FROM MODSAP
WHERE NAME = IT_JTAB-OBJ_NAME AND
TYP = 'E'.
APPEND IT_FINAL.
CLEAR IT_FINAL.
ENDSELECT.
ENDLOOP.
*- Process it_final contents.
LOOP AT IT_FINAL.
L_TABIX = SY-TABIX.
CLEAR: L_FNAME,
L_GROUP,
L_INCLUDE,
L_NAMESPACE,
L_STR_AREA.
L_FNAME = IT_FINAL-MEMBER.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
FUNCNAME = L_FNAME
IMPORTING
GROUP = L_GROUP
INCLUDE = L_INCLUDE
NAMESPACE = L_NAMESPACE
STR_AREA = L_STR_AREA
EXCEPTIONS
FUNCTION_NOT_EXIST = 1
OTHERS = 2.
IF SY-SUBRC = 0.
IF NOT L_INCLUDE IS INITIAL.
*- Get Source code of include.
CLEAR: V_INCLUDE
V_INCLUDE = L_INCLUDE.
CALL FUNCTION 'MU_INCLUDE_GET'
EXPORTING
I_INCLUDE = V_INCLUDE
TABLES
E_T_INCLUDE = E_T_INCLUDE.
IF SY-SUBRC = 0.
LOOP AT E_T_INCLUDE.
IF E_T_INCLUDE-LINE CS 'INCLUDE'.
CLEAR L_LINE.
L_LINE = E_T_INCLUDE-LINE.
CONDENSE L_LINE NO-GAPS.
TRANSLATE L_LINE USING '. '.
L_LINE = L_LINE+7(9).
IT_FINAL-INCLUDE = L_LINE.
MODIFY IT_FINAL INDEX L_TABIX TRANSPORTING INCLUDE.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " get_objects
*&---------------------------------------------------------------------*
*& Form display_results
*&---------------------------------------------------------------------*
* Display Results
*----------------------------------------------------------------------*
FORM DISPLAY_RESULTS.
FORMAT COLOR COL_HEADING.
WRITE:/1(150) SY-ULINE.
WRITE:/ SY-VLINE,
2(23) 'Extension Name',
24 SY-VLINE,
25(39) 'Exit Name',
64 SY-VLINE,
65(74) 'Description',
140 SY-VLINE,
141(9) 'Include',
150 SY-VLINE.
WRITE:/1(150) SY-ULINE.
FORMAT RESET.
SORT IT_FINAL BY NAME MEMBER.
LOOP AT IT_FINAL.
CLEAR TFTIT.
SELECT SINGLE STEXT
INTO TFTIT-STEXT
FROM TFTIT
WHERE SPRAS = 'EN' AND
FUNCNAME = IT_FINAL-MEMBER.
WRITE:/ SY-VLINE,
IT_FINAL-NAME COLOR COL_KEY, 24 SY-VLINE,
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.