cancel
Showing results for 
Search instead for 
Did you mean: 

user exits

Former Member
0 Kudos

how 2 use user exits ,screen exits , menu exits, plz provide me assitance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Give me your mail id, i will send docuements.

Thanks,

Anitha

Former Member
0 Kudos

Hi Anitha,

I am Suresh kumar. Please send Some notes for User exits to my mail id. My ID is sureshv.mca@gmail.com

Thanks in Adv,

Reg,

<b>Suresh. V</b>

Answers (3)

Answers (3)

Former Member
0 Kudos

hi

USEREXIT

User exits allow us to add our own functionality to SAP standard program without modifying it . These are implemented in the form of subroutines and hence are also known as FORM EXITs. The user exits are generally collected in includes and attached to the standard program by the SAP.

All User exits start with the word USEREXIT_...

FORM USEREXIT_...

<User defined code>

ENDFORM.

e.g. USEREXIT_SAVE_DOCUMENT_PREPARE

Example :

1) ADDING OF NEW FIELDS IN PRICING

In Pricing in SD the fields on the basis of which pricing is done are derived from the FIELD CATALOG which is a structure KOMG .This structure is used to transfer transaction data to the pricing procedure in SD and is also known as communication structure. This structure KOMG consists of two tables KOMK for Header related fields and KOMP for item related fields.

The fields which are not in either of the two tables KOMK and KOMP

cannot be used in pricing .Sometimes a need arises when the pricing

is to be based on some other criteria which is not present in the form of fields in either of the two tables.

This problem can be solved by using USEREXITS which are provided for pricing in SD.

Pricing takes place both when the SALES ORDER (Transaction VA01) is created as well as when INVOICING (Transaction VF01) is done. Hence SAP provides 2 user exits ,one for sales order processing which is

USEREXIT_PRICING_PREPARE_TKOMP or

USEREXIT_PRICING_PREPARE_TKOMK

Depending upon which table (KOMK or KOMP) the new fields were inserted we use either of the above two user exits. These user exits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A.

In the case of user exit which will be called when invoicing is done, these are provided in the include RY60AFZZ which is in the standard SAP program SAPMV45A. The names of the user exits are same. i.e.

USEREXIT_PRICING_PREPARE_TKOMP or

USEREXIT_PRICING_PREPARE_TKOMK

These user exits are used for passing the data from the communication structure to the pricing procedure, for this we have to fill the newly created field in the communication structure KOMG for this we fill the code in the above user exit using the MOVE statement after the data that

has to be passed is taken from the database table by using the SELECT statement. The actual structure which is visible in these user exits and which is to be filled for that particular field is TKOMP or TKOMK.

Before the coding for these user exits is done, it is necessary to create a new field in either of the two tables KOMK or KOMP .For this purpose includes are provided in each of them .

To create the field in header data (KOMK) the include provided is KOMKAZ and to create the field in item data(KOMP) the include provided is KOMPAZ.

One possible example for the need of creating new fields can be e.g. Freight to be based upon transportation zone ,for this no field is available in field catalog and hence it can be created in KOMK and then above user exits can be used to fill the transportation data to it.

1) MENU EXITS

Menu exits allow you to add your own functionality to menus. Menu exits are implemented by SAP, and are reserved menu entries in the GUI interface. The developer can add his/her own text and logic for the menu. Function codes for menu exits all start with "+".

Example: We want to create a new menu item in the Office menu. The text for the menu should be "Run ZTEST", and the menu will run report ZTEST.

1) Go to transaction SE43 Area Menu Maintenance.

2) In Area Menu Parameter type 'S000' (S triple Zero).

3) Select Change and ignore all the warning screens.

4) Expand the office menu. In the bottom of the office tree you will find a menu named "Customer function".

5) Double click on the text. In the pop-up screen change the text to "Run ZTEST". Note that the transaction code is +C01. Go to transaction SE93 and create transaction +C01 that calls report ZTEST.

Now you will se the menu displayed in the office tree. If you delete transaction +C01 again, the new menu will disappear.

3) SCREEN EXIT

After you have found one, do as directed in the documentation. Generally, the steps are as follows:

1. Create a project using CMOD including your enhancement.

2. Create the append structure with new fields.

3. Go to the desired function group and create a sub screen with the new fields. Write PBO and PAI for the sub screen, if required.

4. Use the function exits in the enhancement to link the PBO and PAI of the sub screen with that of the main SAP program supporting the SAP transaction.

5. Maintain necessary linkage between the sub screen area of standard SAP program with the custom sub screen developed along with the custom program name. This can be done in the project (developed by CMOD including the enhancement) or outside as a part of configuration.

6. Activate the project.

7. Test to ensure that required functionality is met

Hi

Find the available exits with the following program:::

&----


*& Report ZFINDUSEREXIT

*&

&----


*&

*&

&----


report zfinduserexit.

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

write the code in the right form and check by keeping a break point

HI

To search for a badi, go to se 24 display <b>class cl_exithandler.</b>

double click on method get_instance, get a break point on case statement.

execute and start the required transaction in new session.

look for variable <b>exit_name.</b> It would show the available badi's.

Please do reward if useful

Regards

Dinesh

Former Member
0 Kudos
Former Member
0 Kudos

This question is asked literally on a daily basis. Try using the search, then use help.sap.com.