‎2006 Nov 28 12:12 PM
How i can found user exit
exampl i want to find exit for mmo1
when cmod comes to picture and whwre i make changes,,
Plz tell me as iam new to user exits
thanks in advance
‎2006 Nov 28 12:18 PM
Hi,
Multiple ways.
1. Go to Cmod. Create your project. Select the Enhancement assignement. Choose the enhancement area you are working under using SAP Applications. Go to the components section and activate the same.
2. In case you need to know if a user exit exists for a transaction, easiest way is to find the main program and search for 'Call Customer-function' in it.
Trust this helps. Mark points if helpful.
Regards,
Biju
‎2006 Nov 28 12:16 PM
run this program. Enter the transaction code to find the user exit.
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.
Message was edited by:
Kalpanashri Rajendran
‎2006 Nov 28 12:18 PM
Hi,
Multiple ways.
1. Go to Cmod. Create your project. Select the Enhancement assignement. Choose the enhancement area you are working under using SAP Applications. Go to the components section and activate the same.
2. In case you need to know if a user exit exists for a transaction, easiest way is to find the main program and search for 'Call Customer-function' in it.
Trust this helps. Mark points if helpful.
Regards,
Biju
‎2006 Nov 28 12:18 PM
Use this utility program. Mark pint if helpful
&----
*& Report YBADI_EXIT_FINDER
*&
&----
*&
*&
&----
REPORT ybadi_exit_finder.
*this prog can be used to find user exiots & badi
*source
*https://www.
*/community [original link is broken]
&----
*& Report YBADI_FINDER
*&
&----
*&
*&
&----
This program will find the BADI and exits
TABLES : tstc," Table of Tcode
tadir,"Directory of repository objects
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 :
T code
p_tcode LIKE tstc-tcode,
Program name
p_pgmna LIKE tstc-pgmna .
DATA wa_tadir TYPE tadir.
START-OF-SELECTION.
IF NOT p_tcode IS INITIAL.
Get the details of the TCode from table TSTC
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.
Get the details of the project from table TADIR
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'.
For User exit
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.
‎2006 Nov 28 12:18 PM
Here is a good code for the same
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.
*
&----
REPORT YUSEREXIT .
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
Please check these threads for the differences between CMOD and SMOD
Message was edited by:
Dominic Pappaly
‎2006 Nov 28 12:21 PM
Hi
Thanks a lot for your replies
Assume i know user-exit for particular tcode?
How to proceed after that?
‎2006 Nov 28 12:23 PM
‎2006 Nov 28 12:27 PM
Hi r k,
Assuming that you know the user-exit which is a function module. you could directly open this function module where you could find the z-program (include). You could write the desired modifications in that z-program.
Thanking You,
Kiran Kumar Somaroutu
‎2006 Nov 28 12:23 PM
Hi r k,
You can definitely use the above mentioned program by many. but there is another way to do this too. You get to know the name of the program <prog> for this transaction by seeing the technical details. Now open that program and search for CALL CUSTOMER-FUNCTION-xxx. All these functions xxx would be numbers. Now all the exits which would be EXIT_<prog>_xxx, belong to the transaction to which you made the search.
This is just one more way to find user exit related to the program or transactions known. Please award points if this answer is helpful to you.
Thanking You,
Kiran Kumar Somaroutu.
‎2006 Nov 28 12:26 PM
Hi
You can go to CMOD transaction and create some project, then enter short text, save it, and then click on enhancement assignments. There click on f4 function key, and click SAP Applications, there you will get module wise enhancements, enter that name, and save it. Then click on components there you can find the name of the exit for that particular enhancement or transaction.
CMOD is used to enhance your own screen at the end of all screens, this is generally used when a version gets changed, and if there is a requirement to add more screens to the already screens.
Then you will create screens in screen painter and transaction for that screen, and in enhancement double click on exit, there you will get include program, double click on that include program, then in the include write:
Call Transaction '<Transaction Name which you have created for the screen'.
Save and activate the whole project, and the transaction to which you have attached you screen, then your screen will be displayed at the end of all screens.
Also check out these links
http://sap-img.com/abap/a-short-tutorial-on-user-exits.htm
http://sap-img.com/abap/what-is-user-exits.htm
http://sap-img.com/abap/what-is-the-difference-between-smod-and-cmod.htm
Hope this will help you.
Regards
Haritha.
‎2006 Nov 28 12:26 PM
I know how to find exit .
But what shud i do after getting exit?
‎2006 Nov 28 12:27 PM
i mean i will be including some code...
and where shud i do that??
can i direclt do in standard code?
‎2006 Nov 28 12:32 PM
Hi RK,
See if you know the Function Module ( Function EXist) , where you want to Enchance your reqiurement, There will be an include in the Function Module,. Just click that one and proceed your Code.
<b>Important thing, Check whether, you are coding in perfect Function Module. and your coding reflects your modifications</b>
Thanks
Manju
‎2006 Nov 28 12:35 PM
U need to implement the exit. Create a project in CMOD and add the enhancement int the project. Double click on the enhancement, its a function module, iniside there is an include. Double click on the include. It will give u a warning message. Just enter and it will create the place to write your code.
U can only have the parametrs of the function module inside the exit.
‎2006 Nov 28 12:35 PM
Hi rk,
If u r looking for a Function module exit then find the program for the t-code and search for CALL Customer-Function.You can add ur user defied functionality to the standard one by double clicking on the FM said above which inturn has Z'' includes which are not created.Just double click on those includes and write the code.
If ur looking for exit other than FM exit the u need to find the enhancemnt name attached to the t-code and create project for the enhancement identified in CMOD transaction and after adding ur functionality there u need to activate the same inorder to get triggerred.
Regards,
Bharathi.
‎2006 Nov 28 12:49 PM
Bharathi
In which scenarios you do function module exit and other exits?
where i get enhancement name attached to tcode?
‎2006 Nov 28 1:37 PM
Hi rk,
Menu Exits:
Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications.
Screen Exits
Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screens flow logic.
Function Module Exits
Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits. When you add a new menu item to a standard pulldown menu, you use a function module exit to define the actions that should take place once your menu is activated. Function module exits also control the data flow between standard programs and screen exit fields.
these are the diff type of exits v have....
To get the enhance ment attached to t-code.Follow the below process.
1.Find out the program name for the t-code by going throgh sytem in that transaction.
2.Double click on the program name from the prvious screen and find out the package fo rthe program by going through program attribits tab.
3.Navigate to SMOD transaction and press F4 against the enhancement inpuit field.
4.In the popup window appearing click on Information system wherein u find a package field for inputing the package you found.then press enter it will list out all enhancements related to that t-code along with description.
5.Select the one relevant for you and proceed.
Hope this should be ok.
If these points areuseful u can verywell assign reward points for me.
bye,
Bharathi.
‎2006 Nov 28 12:29 PM
Hi
You can go to CMOD transaction and create some project, then enter short text, save it, and then click on enhancement assignments. There click on f4 function key, and click SAP Applications, there you will get module wise enhancements, enter that name, and save it. Then click on components there you can find the name of the exit for that particular enhancement or transaction.
CMOD is used to enhance your own screen at the end of all screens, this is generally used when a version gets changed, and if there is a requirement to add more screens to the already screens.
Then you will create screens in screen painter and transaction for that screen, and in enhancement double click on exit, there you will get include program, double click on that include program, then in the include write:
Call Transaction '<Transaction Name which you have created for the screen'.
Save and activate the whole project, and the transaction to which you have attached you screen, then your screen will be displayed at the end of all screens.
Also check out these links
http://sap-img.com/abap/a-short-tutorial-on-user-exits.htm
http://sap-img.com/abap/what-is-user-exits.htm
http://sap-img.com/abap/what-is-the-difference-between-smod-and-cmod.htm
Hope this will help you.
Regards
Haritha.
‎2006 Nov 28 12:46 PM
well to add on , goto se38 , pgm name = SNIF and execute.
Here if you know dev class then its a good tool, or if you want to search with trxn then you could write a wrapper around that would take trxn as i/p finds the corr dev class and submit to this program to get results