U (For A User-Defined User Exit) or S (For A Standard User Exit)
U (For A User-Defined User Exit) or S (For A Standard User Exit)
A SAP User Exit is a user defined FORM routine that is used to calculate and/or replace values within a validation, substitution, or rule. User exits have the following format:
U (for a user-defined user exit) or S (for a standard user exit) The user exit number (three digits)
For example, U123 is a user-defined user exit. You can configure the form pool name of the sap user exit and must store it in the table for client-dependent user exits (T80D) in Customizing. Table T80D contains the form pool names for the user exits used in validations, substitutions, and rules. Each validation/substitution form pool is client-dependent. (For more information, refer to the Maintain Client-Dependent User Exits activity in the Implementation Guide (IMG) for Special Purpose Ledger.) Example form pools RGGBS000 and RGGBR000 for client 000 are delivered with the SAP R/3 System. You must copy these form pools and configure them in T80D. The new form pool name should conform to the customer naming convention (beginning with the letter Z ) so that is not overwritten when the next SAP upgrade is installed (for example, ZGGBR000). Example FORM routine for substitution exit 001 (U001). TABLES: COBL. FORM U001. COBL-KOSTL = COBL-BUKRS. ENDFORM. Tables and structures should not be declared in the FORM routines so that the contents can be used together with the calling transaction. SAP exits are FORM routines that have been programmed by SAP. The name of the form pool for SAP exits is SAPFGBEB. If you still store your rules in table T890 (interpreted rules), you cannot use user exits in your rule definition. It is highly recommended that you use report program RGUGBR10 to convert interpreted rules into generated rules so that you can use the Customizing function for maintaining rules. For more information, see Using the Rule Manager Reports .
The following table shows the types of user exits that can be used in validations, substitutions, and rules. User exit type 1 Description Application Example
Rules, validations, and substitutions (prerequisite) Same as user exit type 1, except one Substitutions parameter (the field to be substituted) is defined in the user exit. For example, you can create a substitution routine that analyzes the cost center irrespective of the used field. All data is passed as one parameter; Rules, this exit type can only be used in validations, matrix validations and substitutions. and substitutions (prerequisite)
Validations and rules use exit numbers 1 and 3 from the above table. Substitutions use all of the exit numbers from the above table. For substitutions, you can also create user exits that accept a field as one parameter and then return the changed value in this parameter. This allows you to create a user exit that can be used independently of the field and table name. This type of user exit cannot be used as an entry in the Exit only field in the list of values to be substituted; you can only use this exit type in conjunction with a field name. An example of this user exit type is in form pool RGGBS000. If you want to define a parameter for your user exit that is different from the result of a validation (B_RESULT), you must make an entry for your user exit in the FORM routine GET_EXIT_TITLES in the form pool you defined. It is recommended that you copy the SAP example form pool RGGBR000 for validation exits or RGGBS000 for substitution exits. These example
You can implement company-specific enhancements (user exits) that will provide additional functions. Customer-specific user exits may encompass such activities as:
Defining additional data origins for inspection specifications, results, and short texts for characteristics in the certificate profile (self-defined function modules as table entries) Defining and evaluating additional limitations for the selection of inspection lots and partial lots (SAP user exit with menu function in the certificate profile and function modules) The automatic entry of the characteristic detail (SAP user exit) Defining the layout (text elements from a standard texts, SAPscript layout sets) data in the certificate profile
Defining the layout and the output data for characteristics (special text elements in the SAPscript layout set for the characteristic output format, inspection method and supplementary text, if the result is outside of the tolerance; SAPscript standard texts) Adding new objects to which certificate profiles can be assigned (enhancement of a structure in the dictionary and an SAP user exit with a function module) Using your own program to select the data and entry) print the certificates (as a table
To obtain information about additional enhancement possibilities, you can create a list as follows: 1. Choose Tools ABAP Workbench. The system displays the initial screen for the ABAP Workbench. 1. Choose Utilities Enhancement Definition. The system displays the initial screen for SAP enhancements. 1. Choose the possible entries help for the Enhancement field. The system displays the selection screen for locating SAP enhancements. 1. Enter QC in the Enhancement field. 2. Choose Execute
A user exit is a place in a software program where a customer can arrange for their own tailor-made code. SD module has a large number of User exit available. The below is the create/ change sales order screen (VA01/VA02).
The requirement is to put the validation to the line items such that the quantity field for the line item should not be less than 2 units. Step 1: How to find the appropriate USER EXIT. Go to object navigator(SE80) and select package 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 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 .
There is a lot of confusion in using USER EXIT, like do we need access key to modify the USER EXIT ?. The answer is Yes as well as NO. If you see the include MV45AFZZ.we have many FORMS and ENDFORMS init which is in custom name space. So we dont need key to modify it. Check out the below screen shot.
So open that include and write your logic in ZMV45AFZZ_SAVE_DOCUMENT_PREP. While some EXITs like MV50AFZ1. You need an access key to modify it Dont get puzzled, this is how SAP has given J. Step 2: So we got our USEREXIT ZMV45AFZZ_SAVE_DOCUMENT_PREP. Open it and put the below code inside it. data: lv_flag(1) type c. * exit if not SAVE if sy-ucomm ne SICH. leave to screen sy-dynnr. endif. * check line items clear lv_flag. loop at xvbap where updkz ne D. * This checks for quantity less than 2 * As xvbap-kwmeng is pack with 3 decimal we are comparing with 2000 if xvbap-kwmeng < 2000.
message i000(fb) with quantity is less than 2. lv_flag = X. clear sy-ucomm. exit. endif. endloop. if lv_flag = X. leave to screen sy-dynnr. endif. Go To Transaction VA01/VA02 and try to create/change the order item quantity less than 2.
Ref: http://sapignite.com/user-exits-in-sap-abap-with-tutorial/
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 pull down 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. SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs. These calls have the following syntax: CALL CUSTOMER-FUNCTION 001. Field Exits Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field. Example: The data element BBBNR identifies a companys international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100. The field exit concept lets you create a special function module that contains this logic. You assign the special function module to the data element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number. In 4.6c, you can use "RSMODPRF" program to create field exits. An example of a user exits :MODULE user_exit_0001 INPUT CASE okcode. WHEN 'BACK OR EXIT'. CASE sy-dynnr. WHEN '100'. SET SCREEN 0. LEAVE SCREEN. WHEN '200'. *********************************************************************** *******
**** Note that you can write any code that satisfy your needs. **** **** But in this case, this was wrote as a sample code for reference sake. **** **** And you can test it. **** *********************************************************************** ******* SET SCREEN 100. LEAVE SCREEN. ENDCASE. ENDCASE.