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 to find the User Exit in a Program.

5 REPLIES 5

Former Member
0 Kudos

ou can find screen exit for particuler t.code is

1) Go to SMOD. Press F4 in the Enhancement field.

In the next popup window, click pushbutton ‘SAP Applications’.

A list will appear that contains information on all the enhancements,

categorized under functional areas. Developer must search for the enhancements relevant

to his functional area of interest – for e.g., Purchasing, Asset Accounting, etc.

2) Note down the enhancements. Then, come to the initial screen of SMOD

and view the documentation of each enhancement to find out which one is required for your development

Rewards points if it is useful.

Former Member
0 Kudos

Hi,

You copy and paste this code.Then write your transaction and find its user exits available.

Hope helps.

Thank you.

REPORT ZUSER_EXITS_OF_A_TRANS .
*
* 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.
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*              http://www.sap-img.com
*
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.

Former Member
0 Kudos

Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT

If you know the Exit name, go to transaction CMOD.

Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.

You will now come to a screen that shows the function module exits for the exit.

regards

Giridhar

Former Member
0 Kudos

Hi ,

try the following options................

1.Call customer-function

2. enter transaction> system>status>program>Double click>attribute>get package name> goto se80> Enhancements-->from there u can find

3.Use this program

REPORT Z001_FIND_USEREXITS NO STANDARD PAGE HEADING line-size 150.

TABLES : TSTC, TADIR,

TRDIR, TFDIR, ENLFDIR.

TABLES : TSTCT.

TYPES: BEGIN OF T_INC,

NAME(72),

END OF T_INC.

TYPES: BEGIN OF T_TADIR,

PGMID LIKE TADIR-PGMID, "Program ID in Requests and Tasks

OBJECT LIKE TADIR-OBJECT, "Object Name in Object Directory

OBJ_NAME LIKE TADIR-OBJ_NAME, "Object Name in Object Directory

END OF T_TADIR.

TYPE-POOLS:ICON.

DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.

DATA : FIELD1(30).

DATA: VALUE1(100).

DATA: PNAME LIKE TFDIR-PNAME,

TYPE(6),

INCLUDE LIKE TFDIR-INCLUDE,

T TYPE T_INC OCCURS 0 WITH HEADER LINE,

IC TYPE ICON_D,

V_DEVCLASS LIKE TADIR-DEVCLASS,

V_TEXT(60) TYPE C.

.

PARAMETERS : P_TCODE LIKE TSTC-TCODE OBLIGATORY.

TYPES: BEGIN OF T_MOD,

NAME LIKE MODSAPT-NAME,

MODTEXT LIKE MODSAPT-MODTEXT,

TYP LIKE MODSAP-TYP,

MEMBER LIKE MODSAP-MEMBER,

END OF T_MOD.

DATA: I_MOD TYPE T_MOD OCCURS 0 WITH HEADER LINE,

I_BADI TYPE STANDARD TABLE OF T_TADIR WITH HEADER LINE ,

I_BDCDATA TYPE STANDARD TABLE OF BDCDATA,

WA_BDCDATA TYPE BDCDATA.

&----


&

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

  • Function Module name

SELECT SINGLE * FROM TFDIR WHERE PNAME = TSTC-PGMNA.

  • Additional Attributes for Function Modules

SELECT SINGLE * FROM ENLFDIR WHERE FUNCNAME = TFDIR-FUNCNAME.

  • Directory of Repository Objects

SELECT SINGLE * FROM TADIR WHERE PGMID = 'R3TR'

AND OBJECT = 'FUGR'

AND OBJ_NAME EQ ENLFDIR-AREA.

  • Get development class of the object

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

ENDIF.

ENDIF.

  • Get the SAP enhancements of the development class of the object

SELECT * FROM TADIR INTO TABLE JTAB

WHERE PGMID = 'R3TR'

AND OBJECT = 'SMOD'

AND DEVCLASS = V_DEVCLASS.

  • Get Transaction Code Texts.

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.

LOOP AT JTAB.

  • Getting the components of a exit.

SELECT ANAME AMODTEXT BTYP BMEMBER

INTO CORRESPONDING FIELDS OF TABLE I_MOD

FROM MODSAPT AS A

INNER JOIN MODSAP AS B ON BNAME = ANAME

WHERE A~SPRSL = SY-LANGU

AND A~NAME = JTAB-OBJ_NAME

AND B~TYP <> ''.

LOOP AT I_MOD.

AT NEW MODTEXT.

FORMAT COLOR COL_GROUP INTENSIFIED OFF.

WRITE:/(150) SY-ULINE.

WRITE:/1 SY-VLINE,

2 JTAB-OBJ_NAME HOTSPOT ON,

21 SY-VLINE ,

22 I_MOD-MODTEXT,

92 SY-VLINE,

/1 SY-ULINE(150).

ENDAT.

CLEAR:PNAME,INCLUDE.

  • Deriving the include name inorder to chech whether the exit is *

*implemented or not

SELECT PNAME INCLUDE INTO

(PNAME ,INCLUDE)

FROM TFDIR

WHERE FUNCNAME = I_MOD-MEMBER.

endselect.

PNAME = PNAME+3(37).

CONCATENATE PNAME 'U' INCLUDE INTO PNAME.

  • Reads the function module

READ REPORT PNAME INTO T.

LOOP AT T WHERE NAME CS 'include'.

CLEAR:PNAME,field1.

SHIFT T-NAME LEFT DELETING LEADING SPACE.

SPLIT T-NAME AT ' ' INTO field1 PNAME.

SHIFT PNAME RIGHT DELETING TRAILING ''.

SHIFT PNAME RIGHT DELETING TRAILING '.'.

SHIFT PNAME LEFT DELETING LEADING SPACE.

ENDLOOP.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

  • read the include file

READ REPORT PNAME INTO T.

IF SY-SUBRC = 0.

IC = ICON_OKAY.

ELSE.

IC = ''.

ENDIF.

  • For Exit Types

IF I_MOD-TYP = 'E'.

TYPE = 'Func.'.

ELSEIF I_MOD-TYP = 'S'.

TYPE = 'Screen'.

ELSEIF I_MOD-TYP = 'C'.

TYPE = 'Menu'.

ENDIF.

WRITE: /92 SY-VLINE,

93 IC,

98 SY-VLINE,

99 TYPE,

106 SY-VLINE,

107 I_MOD-MEMBER HOTSPOT ON,

150 SY-VLINE.

CLEAR:PNAME,IC,field1,TYPE.

ENDLOOP.

ENDLOOP.

WRITE:/(150) 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.

*For Badi's..

  • Select BADI entries

SELECT PGMID

OBJECT

OBJ_NAME

FROM TADIR

INTO CORRESPONDING FIELDS OF TABLE I_BADI

WHERE ( PGMID = 'R3TR' ) AND

( OBJECT = 'SXSD' ) AND

( DEVCLASS = V_DEVCLASS ).

  • Write BADI detail header

data:v_count type i.

DESCRIBE TABLE I_BADI LINES V_COUNT.

IF V_COUNT > 0.

WRITE: /(95) SY-ULINE.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE: /1 SY-VLINE,

2 'BADI',

31 SY-VLINE,

32 'Description',

95 sy-vline.

WRITE: /(95) SY-ULINE.

  • Write BADI results

LOOP AT I_BADI.

CLEAR V_TEXT.

SELECT SINGLE TEXT

FROM SXS_ATTRT

INTO V_TEXT

WHERE ( SPRSL = SY-LANGU ) AND

( EXIT_NAME = I_BADI-OBJ_NAME ).

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE: /1 SY-VLINE,

2 I_BADI-OBJ_NAME HOTSPOT ON,

31 SY-VLINE,

32 V_TEXT,

95 SY-VLINE.

ENDLOOP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE: /(95) SY-ULINE.

WRITE: /1 SY-VLINE,

2 'Total BADI''s:',

31 SY-VLINE,

32 V_COUNT,

95 SY-VLINE.

WRITE: /(95) SY-ULINE.

ELSE.

WRITE: /(95) 'No BADI''s exist.'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

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

ENDIF.

AT LINE-SELECTION.

GET CURSOR FIELD FIELD1 VALUE VALUE1.

IF FIELD1(4) EQ 'JTAB'.

  • Jump to transaction SMOD

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

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

ELSEIF FIELD1(5) EQ 'I_MOD'.

  • Viewing the function

SUBMIT WB_MNGR_START_FROM_TOOL_ACCESS AND RETURN

WITH ACTION = 'DISPLAY'

  • WITH OBJDATA = p_object_data

WITH OBJ_TYPE = 'FF'

WITH OBJ_NAME = VALUE1

WITH ENCL_OBJ = ''

WITH POSITION = ''

WITH INCLUDE = ''

WITH VERSION = ''

WITH TOOL = 'CL_FUNCTION_BUILDER'

WITH NEWWNDOW = ''

WITH OBJLIST = ''.

  • Direct BADI to transaction SE18

ELSEIF FIELD1(6) EQ 'I_BADI'.

SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(29).

CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.

ENDIF.

TOP-OF-PAGE.

WRITE:/(150) SY-ULINE.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE:/1 SY-VLINE,

2 'Exit Name',

21 SY-VLINE ,

22 'Description',

92 SY-VLINE,

93 'Imp.',

98 SY-VLINE,

99 'Type',

106 SY-VLINE,

107 'Function Name',

150 SY-VLINE,

/1 SY-ULINE.

Former Member
0 Kudos

Hi

u can execute the program RSMODPRF

Regards

Gregory

Reward points