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

Frieght to be based upon transportation zone .cannot be used in pricing . The name of the userexits are same.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 is necessary to create a new field in either of the two tables KOMK or KOMP .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. 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. 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. Before the coding for these userexits is done .these are provided in the include RY60AFZZ which is in the standard SAP program SAPMV45A. This problem can be solved by using USEREXITS which are provided for pricing in SD.For this purpose includes are provided in each of them . . i.g.These userexits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A. Pricing takes place both when the SALES ORDER ( Transaction VA01) is created as well as when INVOICING ( Transaction VF01) is done.this can be found in the SAP reference IMG generally in the subfolder under SYSTEM MODIFICATION. In the case of userexit which will be called when invoicing is done . 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.Hence SAP provides 2 userexits . The actual structure which is visible in these userexits and which is to be filled for that particular field is TKOMP or TKOMK.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. One possible example for the need of creating new fields can be e. 3)The other method of finding userexits is to find the include in case of SD/MM applications where the userexits are located .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.

to display some information before the order will be saved or for making changes to certain fields before the sales order will be saved. An exit can be coded only once.e the exit which will be implemented in SMOD and after coding has been done the project has to be activated. FUNCTION EXITS . 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.This userexit is used generally for custom checks on different fields . V45A0002 and selecting the component (one which fulfills our need) i. These are also sometimes known as function exits . Before implementing an exit . 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. it is required to create the project by using CMOD selecting the enhancement e. 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. These start from the word EXIT_ followed by the program name and then followed by a three digit number. e. 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. EXIT_SAPMV45A_002 This exit is found in SD in enhancement V45A0002.g.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) .g.

This function exit has one exporting parameters and two importing parameters. Double clicking on this include and it will prompt us that this include does not exists do you want to create this object . e. This exit is used for our purpose.g. Activate the include and Activate the project. 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.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. Double clicking on this exit will takes us to function builder (SE37) . This include will be used to write our custom code . sold-to-party field will come up with a predefined customer .g. E_KUNNR = 301. 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 . Now when ever the SALES ORDER will be created . FIELD EXITS . we are interested in exporting parameter which is E_KUNNR of type KNA1-KUNNR i. e. 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 . 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 yes and the include will be created . 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.These are used to add functionality through ABAP code . In the components you will see the exit EXIT_SAPMV45A_002 . This function also contains a customer include ZXVVA04 .This function exit is located in enhancement no V45A0002 .In this include we can write our own code that will fill the field E_KUNNR.

Screen Exits: Screen exits add fields to screens in R/3 applications.“CALL CUSTOMERSUBSCREEN. SAP creates screen exits by placing special sub screen areas on a standard R/3 screen and calling a customer sub screen from the standard screen’s flow logic. Menu Exits: Menu exits add items to the pull down menus in standard SAP applications. 2. menu. Customer Exits : 1. Go to SE81 and select the relevant module find the enhancement. You can use these menu items to call up your own screens or to trigger entire add-on applications.The field exits are managed. Input parameter contains the data passed to the field exit when the field exit was invoked by the R/3 . These special entries have function codes that begin with "+" (a plus sign).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 function module associated with field exit shows two parameters INPUT and OUTPUT. Go to the program or transaction and search for “CALL CUSTOMER-FUCTION” or “EXIT__nnn” For screen exits go to screen in SE51/SE80 search for. function exits.. 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. 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.created. User Exits Ways to find Enhancements/User exits In SMOD find options of screen.” User Exits & Customer Exits : User Exits: These are subroutines used in the SAP namespace 'hard-coded' at various points within SAP Repository objects. It is called by call customersub screen . We can write our own code to change the output parameter depending upon our requirements.

function .Function Module Exits :Function module exits add functions to R/3 applications. Function module exits also control the data flow between standard programs and screen exit fields. When you add a new menu item to a standard pulldown menu. It is called by Call Customer. you use a function module exit to define the actions that should take place once your menu is activated.3. Function module exits play a role in both menu and screen exits.

Sign up to vote on this title
UsefulNot useful