Skip to Content
author's profile photo
Former Member

User exits documents

can any one provide the information about the User exits and how to work with user exits ?

please provide me step by step informatin.

Regards

vamsi

Add comment
10|10000 characters needed characters exceeded

5 Answers

  • author's profile photo
    Former Member
    Posted on Aug 10, 2007 at 11:46 AM

    hi

    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.

    Function exits:

    1) Find the exit with the above described methods.

    2) Go to cmod and create a project.

    3) Go to enhancement options and specify the exit you want to use.

    4) Go to Components and double click on the suitable function module name.

    5)) You would be taken to Include screen. Double click on the include name and code there.

    regards

    dinesh

    Hope it helps

    Regards

    Dinesh

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 10, 2007 at 10:09 AM

    Hi,

    User exits are used for enhancing SAP standard functionality. For example if you want to have a user specific checking before saving a document, you can use the user exit.

    For more information please check the following sites

    http://www.planetsap.com/userexit_main_page.htm

    http://www.sap-img.com/ab038.htm

    BADI is another type of user exit. Check here for more information

    http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm

    http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci982776,00.html

    To find user exit for a transaction code

    http://www.sapgenie.com/abap/code/abap26.htm

    reward if it helps..

    Regards,

    Omkar.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks a lot for valuable information, and can you guide me in creation of Menu Exit, Screen Exit, Field Exit and Function Module Exit...

      Can you provide step by step procedure for that.

  • author's profile photo
    Former Member
    Posted on Aug 10, 2007 at 10:15 AM
  • author's profile photo
    Former Member
    Posted on Aug 10, 2007 at 10:20 AM

    hi,

    user exits are very easy...

    the following is the procedure to find an appropriate user exit

    1) know for which transaction you have to do enhancemennt

    2) goto se93 t.code and enter the transaction for which u r doing

    enhancement.. click on display mode and get the package name

    3) goto smod t.code .. click on utilities.. find... and give the package

    name.. and find appropriate userexit based on your requirement

    by reading the description of he userexit

    4) goto cmod t.code .. create package .. and give the userexit..

    and write the code in the Include.

    Most of the times atleast 2-3 userexits seems appropriate for our

    requirement.. then go to cmod and look at the parameters in that userexit.

    still if ur unable to find the userexit.. keep break point .. and create the project for each user exit

    regards

    satya sreekanth

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 10, 2007 at 10:36 AM

    hi

    USEREXIT

    Userxits 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 userexits are generally collected in includes and attached to the standard program by the SAP.

    All Userexits start with the word USEREXIT_...

    FORM USEREXIT_..

    z..

    ENDFORM.

    The problem lies in finding the correct userexit and how to find it if one exists for the purpose. Once the correct userexit is found the necessary

    customer code is inserted in the customer include starting with the z..

    in the form routine.

    e.g. USEREXIT_SAVE_DOCUMENT_PREPARE

    Certain application like SD still provide this form of enhancement using userexit but this practice is no longer being followed for newer extensions

    instead they are using EXITs which come bundeled in enhancement packages . Neverthiless existing USEREXITS will be supported by SAP an all the newer versions of SAP.

    HOW TO FIND USEREXITS

    Userexits can be found in number of ways:

    1) To find userexits in SD module , goto object navigator(SE80) and select

    development class from the list and enter VMOD in it. All of the userexits in SD are contained in the development class VMOD. Press

    enter and you will find all the includes which contain userexits in SD for

    different functions like PRICING, ORDER PROCESSING etc. Select the userexit according to the requirement and read the comment inserted in it

    and start coding .

    Some examples of userexits in SD(SALES & DISTRIBUTION ) are:

    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 userexits ,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 userexits.These userexits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A.

    In the case of userexit which will be called when invoicing is done ,these

    are provided in the include RY60AFZZ which is in the standard SAP

    program SAPMV45A. The name of the userexits are same. i.e

    USEREXIT_PRICING_PREPARE_TKOMP or

    USEREXIT_PRICING_PREPARE_TKOMK

    These userexits are used for passing the data from the communication structure to the pricing procedure, for this we have to fill the newely

    created field in the communication structure KOMG for this we fill the code in the above userexit 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 userexits and which is to be filled for that particular field is TKOMP or TKOMK.

    Before the coding for these userexits 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. Frieght 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 userexits can be used to fill the transportation data to it.

    2)The other method of finding userexit is to find the word USEREXIT in the

    associated program of the transaction for which we want to determine userexit using SE38.

    3)The other method of finding userexits is to find the include in case of SD/MM applications where the userexits are located ,this can be found in the SAP reference IMG generally in the subfolder under SYSTEM MODIFICATION.

    Some other examples of userexits in SD are:

    USEREXIT_NUMBER_RANGE

    This userexit is used to assign a different internal document number to the

    sales order(VA01) when it is created depending on some criteria like a different SALES ORGANIZAION(VKORG) .

    USEREXIT_SAVE_DOCUMENT_PREPARE

    This userexit is used to insert the ABAP code which will be called when

    the document (sales order VA01) is just about to be saved.This userexit is used generally for custom checks on different fields , to display some information before the order will be saved or for making changes to certain fields before the sales order will be saved.

    Exits & Enhancements

    There are mainly six types of EXITs in sap which have been collected in the form of enhancement packages and attached to standard code in SAP.

    These are different from USEREXIT in the way that they are implemented

    in the form of FUNCTIONs while in USEREXITS we use form routines for their implementation. These are also sometimes known as function exits .

    These start from the word EXIT_ followed by the program name and then followed by a three digit number.

    e.g. EXIT_SAPMV45A_002

    This exit is found in SD in enhancement V45A0002.

    TYPES OF EXITS

    1)MENU EXITS

    2)FUNCTION EXITS

    3)TABLE EXITS

    4)SCREEN EXITS

    5)KEYWORD EXITS

    6)FIELD EXITS

    We use SAP transactions CMOD and SMOD to manage exits. Before implementing an exit , it is required to create the project by using CMOD

    selecting the enhancement e.g. V45A0002 and selecting the component

    (one which fulfills our need) i.e the exit which will be implemented in SMOD and after coding has been done the project has to be activated.

    An exit can be coded only once.

    FUNCTION EXITS

    These are used to add functionality through ABAP code . These start from the word EXIT_programname_NNN ending in a 3 digit number. No access code is required to implement any tupe of exit including function exits.

    The function exits are called from the standard SAP program in the form

    of ABAP statement

    CALL CUSTOMER-FUNCTION 'NNN'

    This is in contrast to USEREXITs where PERFORM statement is used to call

    the required userexit.

    To implement the FUNCTION EXITs first of all the project is created and a suitable enhancement package is selected and from its compnents the function exit to be implemented is selected and on double clicking it the exit code will appear in ABAP EDITOR(se38) where a Z include will be found and the customer code should be entered in this include.

    e.g.

    ADDING A DEFAULT SOLD-TO-PARTY in Sales Order Creation

    To show a default sold-to-party in this field when the user creates a sales order (VA01) we can use a function exit .This function exit is located

    in enhancement no V45A0002 . Before we can choose the exit we have to

    create a project in CMOD after that enter V45A0002 in the enhancement field and click on the components . In the components you will see the

    exit EXIT_SAPMV45A_002 . This exit is used for our purpose.

    Double clicking on this exit will takes us to function builder (SE37) . This

    function exit has one exporting parameters and two importing parameters, we are interested in exporting parameter which is E_KUNNR

    of type KNA1-KUNNR i.e if we move the desired customer name to this

    structure(E_KUNNR) it will be shown in the field as the default value when we create the sales order.

    This function also contains a customer include ZXVVA04 . This include

    will be used to write our custom code .

    Double clicking on this include and it will prompt us that this include does not exists do you want to create this object ,select yes and the include will be created .In this include we can write our own code that will fill the field E_KUNNR.

    e.g. E_KUNNR = 301.

    Activate the include and Activate the project. Now when ever the SALES ORDER will be created , sold-to-party field will come up with a predefined

    customer .

    FIELD EXITS

    The field exits are managed,created,activated through program RSMODPRF. The field exit is associated with a data element existing in ABAP dictionary and hence to the screen field using that data element.

    The format of field exit is :

    FIELD_EXIT_dataelement_A-Z or 0-9

    If a particular screen and program name is not specified than the field exit will effect all the screens containing that data element.

    The function module associated with field exit shows two parameters

    INPUT and OUTPUT. Input parameter contains the data passed to the field exit when the field exit was invoked by the R/3 , We can write our own code to change the output parameter depending upon our requirements.

    Before the field exit can have any effect the system profile parameter

    ABAP/FIELDEXIT in all the application servers should be set to YES

    ABAP/FIELDEXIT = YES.

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

    Execute the report, give the transaction you want to find user exit, and query.

    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.

    BADI

    http://www.allsaplinks.com/badi.html

    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm

    http://support.sas.com/rnd/papers/sugi30/SAP.ppt

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

    http://members.aol.com/_ht_a/skarkada/sap/

    http://www.ct-software.com/reportpool_frame.htm

    http://www.saphelp.com/SAP_Technical.htm

    http://www.kabai.com/abaps/q.htm

    http://www.guidancetech.com/people/holland/sap/abap/

    http://www.planetsap.com/download_abap_programs.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm

    http://help.sap.com/saphelp_erp2005/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm

    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm

    http://support.sas.com/rnd/papers/sugi30/SAP.ppt

    http://support.sas.com/rnd/papers/sugi30/SAP.ppt

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

    http://members.aol.com/_ht_a/skarkada/sap/

    http://www.ct-software.com/reportpool_frame.htm

    http://www.saphelp.com/SAP_Technical.htm

    http://www.kabai.com/abaps/q.htm

    http://www.guidancetech.com/people/holland/sap/abap/

    http://www.planetsap.com/download_abap_programs.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm.

    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm

    http://support.sas.com/rnd/papers/sugi30/SAP.ppt

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

    http://members.aol.com/_ht_a/skarkada/sap/

    http://www.ct-software.com/reportpool_frame.htm

    http://www.saphelp.com/SAP_Technical.htm

    http://www.kabai.com/abaps/q.htm

    http://www.guidancetech.com/people/holland/sap/abap/

    http://www.planetsap.com/download_abap_programs.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm

    /people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series

    /people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework

    User Exit

    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

    http://www.sapgenie.com/abap/code/abap26.htm

    http://www.sap-img.com/abap/what-is-user-exits.htm

    http://wiki.ittoolbox.com/index.php/HOWTO:Implement_a_screen_exit_to_a_standard_SAP_transaction

    http://www.easymarketplace.de/userexit.php

    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

    http://www.sappoint.com/abap/userexit.pdfUser-Exit

    http://www.planetsap.com/userexit_main_page.htm

    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

    http://www.sapgenie.com/abap/code/abap26.htm

    http://www.sap-img.com/abap/what-is-user-exits.htm

    http://wiki.ittoolbox.com/index.php/HOWTO:Implement_a_screen_exit_to_a_standard_SAP_transaction

    http://www.easymarketplace.de/userexit.php

    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

    http://www.sappoint.com/abap/userexit.pdfUser-Exit

    Please do reward if useful

    Regards

    Dinesh

    Add comment
    10|10000 characters needed characters exceeded