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

Former Member
0 Kudos

how to find a user exits in program..

suppose we have transaction, by using that how can i get a user exit?

Reagrds,

pandu.

4 REPLIES 4

Former Member
0 Kudos

Hi

There are many ways to find user exits in the standard transaction.....go through these steps....

Locating User Exits

Before you can add functionality to a SAP system, you need to be able to locate the appropriate user exits. SAP has provided around 2000 user exits.

In this document, we will cover a couple of methods to accomplish this task:

Searching from transaction CMOD

Searching from the Application Hierarchy

Making your own customized search

Keep in mind that you must first search for an enhancement. Once you find an enhancement, you can display its components -- the actual user exits. Then you need to include the enhancement containing the required user exit as a component in your own project.

Method #1: Using Transaction CMOD

- Transaction CMOD contains search functionality to help locate enhancements.

- Selecting the "Utilities -> SAP enhancements" menu path in transaction CMOD will take you to an enhancement selection screen (see graphic above).

- You can limit the search for enhancements based on:

Enhancement name

Development class

- After clicking on the ‘Execute’ pushbutton (or ‘F8’) on the selection screen, the system will display a listing of the development classes that contain enhancements (see graphic above).

- From this listing, you can double-click a development class to display its enhancements.

- If you have clicked on the ‘Display components’ pushbutton on the selection screen (see graphic on previous page), the components of each enhancement will automatically be displayed.

Remark: To use this search method one must either know the part of the enhancement name or the development class. But if one looks at SAP’s naming convention for user exits (see note below), the screen numbers/program names/ function codes/etc are contained in the components name and there is no scope for that in selection options.

Also one cannot restrict the search to only one type of exit.

Method #2: Using SAP Application Hierarchy

- Selecting the "Overview -> Applic. hierarchy -> SAP" menu path in the ABAP/4 Development Workbench will take you to a listing of all standard SAP applications and components (see graphic above).

- To locate a user exit for a particular application, follow these steps from the SAP Application Hierarchy:

- Select the appropriate application by single clicking on it.

- Choose the "Edit Sel./desel. subtree" menu path.

- Click on the ‘Repository Infosys.’ pushbutton.

- This will take you to the ABAP/4 Repository Information System.

- Double click on the ‘Environment’ branch.

- Double click on the ‘Customer enhancement’ branch.

- Double-click on the ‘Customer exit’ branch.

- This will take you to the customer exit (or enhancement) selection screen with the appropriate development class for the application selecting on the Application Hierarchy.

- Click on the ‘Execute’ pushbutton.

- This will take you to a listing of all enhancements that meet the selection criteria.

From this listing, you can display the components of each enhancement and the documentation. You will be taken automatically to transaction SMOD from the ABAP/4 Repository Information System.

Remark: To use this one must have knowledge about the application hierarchy to which that particular enhancement belongs. Also one has to explode individual enhancements to identify weather the component is contained in that enhancement.

Like previous method, there is no scope for selection option on the components name.

Method #3: Writing a small report program

The details about projects, enhancements and components are contained in two SAP tables:

MODSAP: containing enhancement name, type of exit and component

MODACT: containing project name and enhancements

Thus by writing a report program to retrieve data from these two tables, you can customize your search requirements.

Code for one such sample program is attached in annexure A and the corresponding transaction code to execute this program is YSMD .

Using this you can list all components that match a particular string like the program name or the function code as well as search for only one type of exit.

NOTE: SAP’s naming convention for user exits-

• Program/Function exits : EXIT_AAAAAAAA_nnn where

AAAAAAAA stands for the program name which contains the exit and

nnn is a SAP assigned number starting from 001

• Menu exits : AAAAAAAA+XXX where

AAAAAAAA stands for the program name which contains the exit and

+XXX is the name of the function code contained in the menu item

• Screen Exits : AAAAAAAA_nnnn_BBBBBBBB_CCCCCCCC_mmmm where

AAAAAAAA : calling program name

nnnn : calling screen number

BBBBBBBB : area

CCCCCCCC : called program name

mmmm : called screen number

________________________________________________________________________

Here is a program to find exits and BAdis for a transaction....just cut and paste it in ur abap editor and execute......

&----


*& Report Z_TO_FIND_BADI_EXITS *

*& *

&----


*& *

*& *

&----


REPORT Z_TO_FIND_BADI_EXITS.

TABLES : TSTC,

TADIR,

MODSAPT,

MODACT,

TRDIR,

TFDIR,

ENLFDIR,

SXS_ATTRT ,

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,

P_PGMNA LIKE TSTC-PGMNA .

DATA wa_tadir type tadir.

START-OF-SELECTION.

IF NOT P_TCODE IS INITIAL.

SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.

ELSEIF NOT P_PGMNA IS INITIAL.

TSTC-PGMNA = P_PGMNA.

ENDIF.

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 in ('SMOD', 'SXSD')

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:/(105) SY-ULINE.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

  • Sorting the internal Table

sort jtab by OBJECT.

data : wf_txt(60) type c,

wf_smod type i ,

wf_badi type i ,

wf_object2(30) type C.

clear : wf_smod, wf_badi , wf_object2.

  • Get the total SMOD.

LOOP AT JTAB into wa_tadir.

at first.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE:/1 SY-VLINE,

2 'Enhancement/ Business Add-in',

41 SY-VLINE ,

42 'Description',

105 SY-VLINE.

WRITE:/(105) SY-ULINE.

endat.

clear wf_txt.

at new object.

if wa_tadir-object = 'SMOD'.

wf_object2 = 'Enhancement' .

elseif wa_tadir-object = 'SXSD'.

wf_object2 = ' Business Add-in'.

endif.

FORMAT COLOR COL_GROUP INTENSIFIED ON.

WRITE:/1 SY-VLINE,

2 wf_object2,

105 SY-VLINE.

endat.

case wa_tadir-object.

when 'SMOD'.

wf_smod = wf_smod + 1.

SELECT SINGLE MODTEXT into wf_txt

FROM MODSAPT

WHERE SPRSL = SY-LANGU

AND NAME = wa_tadir-OBJ_NAME.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

when 'SXSD'.

  • For BADis

wf_badi = wf_badi + 1 .

select single TEXT into wf_txt

from SXS_ATTRT

where sprsl = sy-langu

and EXIT_NAME = wa_tadir-OBJ_NAME.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

endcase.

WRITE:/1 SY-VLINE,

2 wa_tadir-OBJ_NAME hotspot on,

41 SY-VLINE ,

42 wf_txt,

105 SY-VLINE.

AT END OF object.

write : /(105) sy-ULINE.

ENDAT.

ENDLOOP.

WRITE:/(105) SY-ULINE.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ 'No.of Exits:' , wf_smod.

WRITE:/ 'No.of BADis:' , wf_badi.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(105) 'No userexits or BADis exist'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(105) 'Transaction does not exist'.

ENDIF.

AT LINE-SELECTION.

data : wf_object type tadir-object.

clear wf_object.

GET CURSOR FIELD FIELD1.

CHECK FIELD1(8) EQ 'WA_TADIR'.

read table jtab with key obj_name = sy-lisel+1(20).

move jtab-object to wf_object.

case wf_object.

when 'SMOD'.

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

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

when 'SXSD'.

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

CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.

endcase.

______________________________________________________________

Reward if found helpful...

Badrinath

Message was edited by:

Badri Thiriveedhi

Former Member
0 Kudos

Hi,

You can find out userexits for a perticular transaction by the follwing way,

User exits are maintained for a Package.

1. suppose you have a tcode, then in the menu bar, go to <b>System->Status-->get the program name of the tcode </b>.

2. then go inside the program, then menubar <b>Go to--> Attributes-->get the Package name of the program</b>

3. then open tcode <b>SMOD</b> and press F4 option on the Enhancement field

4. A pop-up will come there you have the <b>Package</b> filed....enter the Package name there.

5. then click Enter. you will get a no. of possible user exits for the tcode.

Thanks,

Bhawani

Message was edited by:

BHAWANI SHANKAR MOHANTY

Former Member
0 Kudos

hi,

goto se93 t.code

enter the transaction and get the package name

goto smod...

click on utilties .. find on the tool bar

enter the package name and execute it...

u get a list of userexits....

regards

sree

Former Member
0 Kudos

hi,

check that ur system having Program named ZUSEREXIT,

otherwise this is the code, u just need to enter T-code.

List of all user exit will come.

&----


*& Include ZUSEREXIT

&----


report zuserexit no standard page heading.

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.

reward if useful.