Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

User exit

Former Member
0 Kudos

how t o find the user exit for any t -code

1 ACCEPTED SOLUTION

Former Member
0 Kudos

************************************************************************

  • Finding the user-exits of a SAP transaction code

*

  • Enter the transaction code in which you are looking for the user-exit

  • and it will list you the list of user-exits in the transaction code.

  • Also a drill down is possible which will help you to branch to SMOD.

*

************************************************************************

*----


  • TABLES DECLARATION

*----


TABLES : TSTC, "SAP Transaction Codes.

TADIR, "Directory of Repository Objects.

MODSAPT, "SAP Enhancements - Short Texts.

MODACT, "Modifications.

TRDIR, "System table TRDIR.

TFDIR, "Function Module.

ENLFDIR, "Additional Attributes for Function Modules

TSTCT. "Transaction Code Texts

*----


  • INTERNAL TABLE DECLARATIONS

*----


DATA : ITAB LIKE TADIR OCCURS 0 WITH HEADER LINE.

*----


  • DATA DECLARATIONS

*----


DATA : V_FIELD1(30).

DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.

*----


  • INPUT SCREEN DECLARATIONS

*----


PARAMETERS : P_TCODE LIKE TSTC-TCODE OBLIGATORY.

*----


  • START OF SELECTION EVENT

*----


START-OF-SELECTION.

*--Read SAP Transaction Code from the given input.

SELECT SINGLE *

FROM TSTC

WHERE TCODE EQ P_TCODE.

IF SY-SUBRC EQ 0.

*--Get the Directory of Repository Objects for the

*---selected program name.

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.

*--Read System table TRDIR for the selected program name.

SELECT SINGLE *

FROM TRDIR

WHERE NAME = TSTC-PGMNA.

*--Get the function module name for the selected program name.

IF TRDIR-SUBC EQ 'F'.

SELECT SINGLE *

FROM TFDIR

WHERE PNAME = TSTC-PGMNA.

*--Get the function group for the selected program name.

SELECT SINGLE *

FROM ENLFDIR

WHERE FUNCNAME = TFDIR-FUNCNAME.

*--Read the development class for the corresponding function group.

SELECT SINGLE *

FROM TADIR

WHERE PGMID = 'R3TR' AND

OBJECT = 'FUGR' AND

OBJ_NAME EQ ENLFDIR-AREA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

ENDIF.

ENDIF.

*--Read all the entries into the internal table itab.

SELECT *

FROM TADIR

INTO TABLE ITAB

WHERE PGMID = 'R3TR' AND

OBJECT = 'SMOD' AND

DEVCLASS = V_DEVCLASS.

*--Read Transaction code information from the table tstct.

SELECT SINGLE *

FROM TSTCT

WHERE SPRSL EQ SY-LANGU AND

TCODE EQ P_TCODE.

*-- Column Headings

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

WRITE:/(19) 'Transaction Code - ',

20(20) P_TCODE,

45(50) TSTCT-TTEXT.

SKIP.

IF NOT ITAB[] 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 ITAB.

*--Read SAP Enhancements short texts information.

SELECT SINGLE *

FROM MODSAPT

WHERE SPRSL = SY-LANGU AND

NAME = ITAB-OBJ_NAME.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE:/1 SY-VLINE,

2 ITAB-OBJ_NAME HOTSPOT ON,

21 SY-VLINE ,

22 MODSAPT-MODTEXT,

95 SY-VLINE.

ENDLOOP.

WRITE:/(95) SY-ULINE.

DESCRIBE TABLE ITAB.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ 'No of Exits:' , SY-TFILL.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'No User Exit exists'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'Transaction Code Does Not Exist'.

ENDIF.

*----


  • AT LINE-SELECTION EVENT

*----


AT LINE-SELECTION.

GET CURSOR FIELD V_FIELD1.

CHECK V_FIELD1(4) EQ 'ITAB'.

SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).

*-- call transation SMOD : Sap Enhancement.

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

*---End of Program

2 REPLIES 2

Former Member
0 Kudos

************************************************************************

  • Finding the user-exits of a SAP transaction code

*

  • Enter the transaction code in which you are looking for the user-exit

  • and it will list you the list of user-exits in the transaction code.

  • Also a drill down is possible which will help you to branch to SMOD.

*

************************************************************************

*----


  • TABLES DECLARATION

*----


TABLES : TSTC, "SAP Transaction Codes.

TADIR, "Directory of Repository Objects.

MODSAPT, "SAP Enhancements - Short Texts.

MODACT, "Modifications.

TRDIR, "System table TRDIR.

TFDIR, "Function Module.

ENLFDIR, "Additional Attributes for Function Modules

TSTCT. "Transaction Code Texts

*----


  • INTERNAL TABLE DECLARATIONS

*----


DATA : ITAB LIKE TADIR OCCURS 0 WITH HEADER LINE.

*----


  • DATA DECLARATIONS

*----


DATA : V_FIELD1(30).

DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.

*----


  • INPUT SCREEN DECLARATIONS

*----


PARAMETERS : P_TCODE LIKE TSTC-TCODE OBLIGATORY.

*----


  • START OF SELECTION EVENT

*----


START-OF-SELECTION.

*--Read SAP Transaction Code from the given input.

SELECT SINGLE *

FROM TSTC

WHERE TCODE EQ P_TCODE.

IF SY-SUBRC EQ 0.

*--Get the Directory of Repository Objects for the

*---selected program name.

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.

*--Read System table TRDIR for the selected program name.

SELECT SINGLE *

FROM TRDIR

WHERE NAME = TSTC-PGMNA.

*--Get the function module name for the selected program name.

IF TRDIR-SUBC EQ 'F'.

SELECT SINGLE *

FROM TFDIR

WHERE PNAME = TSTC-PGMNA.

*--Get the function group for the selected program name.

SELECT SINGLE *

FROM ENLFDIR

WHERE FUNCNAME = TFDIR-FUNCNAME.

*--Read the development class for the corresponding function group.

SELECT SINGLE *

FROM TADIR

WHERE PGMID = 'R3TR' AND

OBJECT = 'FUGR' AND

OBJ_NAME EQ ENLFDIR-AREA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

ENDIF.

ENDIF.

*--Read all the entries into the internal table itab.

SELECT *

FROM TADIR

INTO TABLE ITAB

WHERE PGMID = 'R3TR' AND

OBJECT = 'SMOD' AND

DEVCLASS = V_DEVCLASS.

*--Read Transaction code information from the table tstct.

SELECT SINGLE *

FROM TSTCT

WHERE SPRSL EQ SY-LANGU AND

TCODE EQ P_TCODE.

*-- Column Headings

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

WRITE:/(19) 'Transaction Code - ',

20(20) P_TCODE,

45(50) TSTCT-TTEXT.

SKIP.

IF NOT ITAB[] 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 ITAB.

*--Read SAP Enhancements short texts information.

SELECT SINGLE *

FROM MODSAPT

WHERE SPRSL = SY-LANGU AND

NAME = ITAB-OBJ_NAME.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE:/1 SY-VLINE,

2 ITAB-OBJ_NAME HOTSPOT ON,

21 SY-VLINE ,

22 MODSAPT-MODTEXT,

95 SY-VLINE.

ENDLOOP.

WRITE:/(95) SY-ULINE.

DESCRIBE TABLE ITAB.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ 'No of Exits:' , SY-TFILL.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'No User Exit exists'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'Transaction Code Does Not Exist'.

ENDIF.

*----


  • AT LINE-SELECTION EVENT

*----


AT LINE-SELECTION.

GET CURSOR FIELD V_FIELD1.

CHECK V_FIELD1(4) EQ 'ITAB'.

SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).

*-- call transation SMOD : Sap Enhancement.

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

*---End of Program

0 Kudos

Would that program find MV45AFZZ..............for example.