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 exits in transactions

Former Member
0 Kudos

hi,

how can we find user exits in a given transaction.

thanks

Abhishek

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is a little report program that will help. It may not be 100%.



report z_find_user_exit no standard page heading.

tables: tstc, tadir, modsapt, modact,
        trdir, tfdir, enlfdir, tstct.

data : jtab like tadir occurs 0 with header line.
data : hotspot(30).

parameters : p_tcode like tstc-tcode obligatory.

at line-selection.
  get cursor field hotspot.
  check hotspot(4) eq 'JTAB'.
  set parameter id 'MON' field sy-lisel+1(10).
  call transaction 'SMOD' and skip first screen.

start-of-selection.

  perform get_data.
  perform write_list.


*---------------------------------------------------------------------*
*       FORM get_data                                                 *
*---------------------------------------------------------------------*
form get_data.

  select single * from tstc
              where tcode eq p_tcode.
  check sy-subrc eq 0.

  select single * from tadir
            where pgmid = 'R3TR'
              and object = 'PROG'
              and obj_name = tstc-pgmna.


  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 eq enlfdir-area.
    endif.

  endif.

  select * from tadir into table jtab
             where pgmid = 'R3TR'
               and object = 'SMOD'
               and devclass = tadir-devclass.

  select single * from tstct
          where sprsl eq sy-langu
            and tcode eq p_tcode.

endform.

*---------------------------------------------------------------------*
*       FORM write_list                                               *
*---------------------------------------------------------------------*
form write_list.

  format color col_positive intensified off.
  write:/(19) 'Transaction Code - ',
  20(20) p_tcode,
  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:/ 'No of Exits:' , sy-tfill.
  else.
    format color col_negative intensified on.
    write:/(95) 'No User Exit exists'.
  endif.

endform.


Regards,

Rich Heilman

Former Member
0 Kudos

Hi Abhishek,

this report will give you the userexits. Just copy it and run. The report is going to ask you the transaction for which you are looking for a UE.


report zzexitstcode .

* 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 : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode obligatory.

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 eq 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:/(19) 'Transaction Code - ',
       20(20) p_tcode,
       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:/ '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.
  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.

*---End of Program

Former Member
0 Kudos


*&---------------------------------------------------------------------*
*& Report  YCHATEST                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT z_find_userexit NO STANDARD PAGE HEADING.



*&---------------------------------------------------------------------*

*&  Enter the transaction code that you want to search through in order

*&  to find which Standard SAP User Exits exists.

*&

*&---------------------------------------------------------------------*



*&---------------------------------------------------------------------*

*& Tables

*&---------------------------------------------------------------------*



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



*&---------------------------------------------------------------------*

*& Variables

*&---------------------------------------------------------------------*



DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.

DATA : field1(30).

DATA : v_devclass LIKE tadir-devclass.



*&---------------------------------------------------------------------*

*& 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.

SELECTION-SCREEN END OF BLOCK a01.



*&---------------------------------------------------------------------*

*& Start of main program

*&---------------------------------------------------------------------*



START-OF-SELECTION.



* Validate Transaction Code

  SELECT SINGLE * FROM tstc

    WHERE tcode EQ p_tcode.



* Find Repository Objects for transaction code

  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.



* Find SAP Modifactions

    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:/(19) 'Transaction Code - ',

    20(20) p_tcode,

    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:/ '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.



* Take the user to SMOD for the Exit that was selected.

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.

former_member188685
Active Contributor
0 Kudos

Hi,

Check this link..

<a href="http://72.14.203.104/search?q=cache:jhmF9Evk_60J:www.sapgenie.com/abap/code/abap26.htmUSEREXITSINABAP&hl=en&gl=in&ct=clnk&cd=4">User exits in transaction</a>

Regards

Vijay

Former Member
0 Kudos

Hi,

You can try my program...

Regards,

Raj

&----


*& Report Z_USEREXIT_DISPLAY *

*& *

&----


*& *

*& *

&----


  • Title : Display UserExits *

  • Object Owner : RAJ *

  • Functional Consultant : *

  • Technical Consultant : Mr. Rajasekhar Dinavahi *

  • Date : 03-AUG-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.

IF NOT it_tstc[] IS INITIAL.

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, e_t_include, e_t_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,

25 it_final-member, 64 sy-vline,

65 tftit-stext, 140 sy-vline,

141 it_final-include, 150 sy-vline.

WRITE:/1(150) sy-uline.

ENDLOOP.

ENDFORM. " display_results

ferry_lianto
Active Contributor
0 Kudos

Hi Abhishek,

Please take a look at this sample code.

REPORT z_find_userexit NO STANDARD PAGE HEADING.

*&---------------------------------------------------------------------*
*&  Enter the transaction code that you want to search through in order
*&  to find which Standard SAP User Exits exists.
*&---------------------------------------------------------------------*

 

*&---------------------------------------------------------------------*

*& Tables

*&---------------------------------------------------------------------*

 

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

 

*&---------------------------------------------------------------------*

*& Variables

*&---------------------------------------------------------------------*

 

DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.

DATA : field1(30).

DATA : v_devclass LIKE tadir-devclass.

 

*&---------------------------------------------------------------------*

*& 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.

SELECTION-SCREEN END OF BLOCK a01.

 

*&---------------------------------------------------------------------*

*& Start of main program

*&---------------------------------------------------------------------*

 

START-OF-SELECTION.

 

* Validate Transaction Code

  SELECT SINGLE * FROM tstc

    WHERE tcode EQ p_tcode.

 

* Find Repository Objects for transaction code

  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.

 

* Find SAP Modifactions

    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:/(19) 'Transaction Code - ',

    20(20) p_tcode,

    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:/ '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.

 

* Take the user to SMOD for the Exit that was selected.

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.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

All the mentioned programs works base on Development class. SOme FICO objects consist of Multiple development class. In that case you might not get complete list of user exit base on Tcode.

These programs will not returns the list of BADIs. which you can also use to include cusom code.

In SD side for Example VA01 User exit are in form of Subroutines.