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 user exits?ans.plz

4 REPLIES 4

Former Member
0 Kudos

Hi,

Goto Corresposnding Transaction(for ex XD01).

Goto the System menu /status.

double Click on the program name.

Clcik on the find button in statndard toolbar:

u need to give CALL CUSTOMER-FUNCTION for function module exits,

+OBB for menu exits,

CALL CUSTOMER-SUBSCREEN for screen exits.

Userexit is a methodology using which we can add our custom code in the SAP Standard transaction without disturbing the SAP Standard code. SAP will provide enhancement for one transaction. We can have more then one enhancement. Enhancement is a container with a set of userexits. SAP will provide only definition of the exit. Which does not contain any standard code. In the relevant transaction program SAP will call their exit as a standard. The Userexit needs to be implemented inorder to provide a custom logic to serve business requirement.

SMOD: It is used to find the enhancement related to different applications.

CMOD: It is used to implement the userexit.

There are 4 types of exits available:

1) Function-module Exits,

2) Menu exits,

3) Screen exits and

4) Field exits.

1) Functionmodule exits:

These exits are used to provide additional functionality to SAP standard transaction. By default SAP is not provided this functionality.

For Example my requirement is, when user create or change customer and the customer belongs to US Country the Industry sector (brsch) field is not empty.

Step1: Find the enhancement. For that one goes to SMOD.

Click on F4 on Enhancement. We Search for enhancement. In this case we can found the enhancement by giving the Description: mast. We got the enhancement as

SAPMF02D: User exits: Customer master data.

(Or)

We find the enhancement at transaction level,

Go to XD01 transaction click on System/Status/double click on Program name

In this program we search for “CALL customer-function’. We get the all related exits the starts with EXIT name._ enhancementname_Threedigitnumber. Sometimes it Will not an enhancement

Step2: Go to CMOD create the custom project.

Click on Enhancement assignments button

Give the Enhancement name: SAPMF02D

Step 3: Click on Components button. Under that we found the one function module:

EXIT_ SAPMF02D_001. Double Click on that function module. In the Source code tab of this function module SAP provide the one Zinclude. SAP doesn’t know our requirement. In this Zinclude we provide our own custom logic to make of the parameters provided in import, export and tables section.

We write the following code:

IF i_kna1-land1 = 'US' AND

i_kna1-brsch = ' ‘.

MESSAGE e001 (f2) WITH ‘ Industry sector should not be blank for US Customers’.

ENDIF.

Step4: SAVE, CHECH and ACTIVATE the Cutsom project.

Step5: Now go to XD01 Transaction We perform our requirement. After we don’t want that requirement go to CMOD and deactivated the custom project.

If it is helpful rewards points

Regards

Pratap.M

Former Member
0 Kudos

Hello...

There are 3 main ways to find exits

1) Option 1 : you don't know the name or dont have any info on user exit

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

run T-code : SPRO

SPRO -> Click SAP Reference IMG -> click in the relevant module eg: SD (sales and Distribution) ->System Modifications -> User exits

You can view documentation to understand the purpose of that user exit

It is not that always one can find the user exits under the name "System modifications" but with respect to a module definitely user exits can be found under that module in SPRO

2) Option 2 : You know the name of the user exit

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

Run Tcode : SMOD -> fill in the enhancement name-> click on attributes and then components or directly on components and view the include...if already a code is written in the include,then on double click of include you can see the code...if an existing code is not there and you double click on the include,SAP prompts for a request

3)Option3: You can use the custom code..which was contributed to SDN

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

Create a new report program -> copy the code -> activate -> run

on the p_tcode : give the name of the tcode for which you need to find the user exits and execute...a list of exits will be displayed...double click and follow the link

**********************************ABAP CODE :***********************************

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.

Regards

Former Member
0 Kudos

Hello Kiran,

Pls explain what is development class, how to create it, enchancements, some realtime work done in user exits(i want to know how it is used in a project), as well as BADI implementation.

Thanks

Former Member
0 Kudos