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

Former Member
0 Kudos
429

Hi all,

Can anybody please provide knowledge about User Exits in Detail?

Thanks in advance....

4 REPLIES 4

Former Member
0 Kudos
123

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.

http://help.sap.com/saphelp_bw21c/helpdata/en/c8/19762743b111d1896f0000e8322d00/content.htm

http://help.sap.com/saphelp_bw21c/helpdata/en/c8/19762743b111d1896f0000e8322d00/frameset.htm

http://www.erpgenie.com/sap/abap/code/abap26.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

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662...

http://www.sappoint.com/abap/spmp.pdf

http://www.sappoint.com/abap/userexit.pdf

http://www.sapdevelopment.co.uk/enhance/mod_sapmenu.htm

http://www.sapdevelopment.co.uk/enhance/enhancehome.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

http://help.sap.com/saphelp_erp2005/helpdata/en/94/bef83770798b76e10000009b38f842/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/13/1f2d1a831a43be8a43ecd14170bf1c/frameset.htm

regards

dinesh

vivek SAXENA

Posts: 20

Questions: 0

Registered: 7/30/07

Forum points: 20

Re: User Exits

Posted: Aug 1, 2007 11:38 AM in response to: Raghu Ram Reply E-mail this post

hi

go thru the following links

http://help.sap.com/saphelp_47x200/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/frameset.htm

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

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

Thanks,

Reward If Helpful.

Former Member
0 Kudos
123

Hi,

User exits :

1. Introduction

2. How to find user exits

3. Using Project management of SAP Enhancements

1. Introduction:

User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a functionmodule. The code for the function module is writeen by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for functionmodule exits is:

EXIT_<program name><3 digit suffix>

The call to a functionmodule exit is implemented as:

CALL CUSTOMER.-FUNCTION ❤️ digit suffix>

Example:

The program for transaction VA01 Create salesorder is SAPMV45A

If you search for CALL CUSTOMER-FUNCTION i program

SAPMV45A you will find ( Among other user exits):

CALL CUSTOMER-FUNCTION '003'

exporting

xvbak = vbak

xvbuk = vbuk

xkomk = tkomk

importing

lvf_subrc = lvf_subrc

tables

xvbfa = xvbfa

xvbap = xvbap

xvbup = xvbup.

The exit calls function module EXIT_SAPMV45A_003

2. How to find user exits? Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT

If you know the Exit name, go to transaction CMOD.

Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.

You will now come to a screen that shows the function module exits for the exit.

3. Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .

- Go to transaction CMOD

- Create a project called ZVA01

- Choose the Enhancement assign radio button and press the Change button

In the first column enter V45A0002 Predefine sold-to party in sales document.

Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayed

Press Save

Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002. Double click on the exit.

Now the function module is displayed. Double click on include ZXVVAU04 in the function module

Insert the following code into the include: E_KUNNR = '2155'.

Activate the include program. Go back to CMOD and activate the project.

Goto transaction VA01 and craete a salesorder.

Note that Sold-to-party now automatically is "2155"

Some Userexits:

MBCF0002 Customer function exit: Segment text in material doc. item

MBCF0005 Material document item for goods receipt/issue slip

MBCF0006 Customer function for WBS element

MBCF0007 Customer function exit: Updating a reservation

MBCF0009 Filling the storage location field

MBCF0010 Customer exit: Create reservation BAPI_RESERVATION_CREATE1

MBCF0011 Read From RESB and RKPF For Print List in MB26

MBCFC003 Maintenance of batch master data for goods movements

MBCFC004 Maintenance of batch specifications for goods movements

User Exits

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

www.sap-img.com/ab038.htm

www.planetsap.com/userexit_main_page.htm

1. Learn user exits :

http://www.sapgenie.com/links/abap.htm

2. finding user exits :

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

3. A short tutorial on user exits :

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

4. Introduction to user exits with examples :

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

5. Difference between BADI and user exits :

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

FOR EXAMPLE CHECK...

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

LINKS :

http://www.erpgenie.com/sap/abap/code/abap26.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

http://www.sapdevelopment.co.uk/enhance/enhancehome.htm

Regards,

Padmam.

Former Member
0 Kudos
123

hI

EXIT s are nothing but the R/3 Enhancements which allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications.

Purpose

Use

Challenges

<b>Purpose</b>

To introduce the techniques of enhancement in standard SAP system. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.

<b>Use</b>

They do not affect standard SAP source code.

When you add new functionality to your SAP System using SAP’s exits, you do not alter the source code of standard SAP programs in any way. The code and screens you create are encapsulated as separate objects. These customer objects are linked to standard applications, but exist separately from SAP’s standard software package.

They do not affect software updates.

When you add new functionality to your SAP System using SAP’s exits, your objects (called customer objects) must adhere to strict naming conventions. When it comes time to upgrade a to a new software release, customer objects’ names ensure that they will not be affected by any changes or new additions to the standard software package.

<b>Challenges</b>

Customer exits are not available for all programs and screens found in the SAP System.

<b>WHAT ARE MODIFICATIONS?</b>

Any change made to an SAP object in a customer system is called a modification. Customers usually modify their systems for one of two reasons. Either they make changes to the SAP standard in order to adjust the R/3 System to their specific business needs (actual modifications), or they alter individual SAP objects in order to correct an error (as recommended in an SAP error note).

You should only modify the SAP standard if the modifications you want to make are absolutely necessary for optimizing work flow in your company. Be aware that good background knowledge of application structure and flow are important prerequisites for deciding what kind of modifications to make and how these modifications should be designed.

<b>ABAP DICTIONARY</b>

Table Enhancements: There are two ways that you can add additional fields to tables without modifying your system.

<b>Append Structures:</b>

Append structures allow you to enhance tables by adding fields to them that are not part of the standard. With append structures, customers can add their own fields to any table or structure they want.

Append structures are created for use with a specific table. However, a table can have multiple append structures assigned to it.

<b>Customizing Includes:</b>

If customers know in advance that one of the tables or structures delivered to them by SAP needs to have customer-specific fields added to it, an SAP application developer can include these fields in the table using a Customizing include statement.

The same Customizing include can be used in multiple tables or structures. This provides for consistency in these tables and structures whenever the itself include is altered.

Append structures allow you to attach fields to a table without actually having to modify the table itself.

Append structures may only be assigned to a single table. A table may, however, have several append structures attached to it. Whenever a table is activated, the system searches for all active append structures for that table and attaches them to the table. If an append structure is created or changed and then activated, the table it is assigned to is also activated, and all of the changes made to the append structure take effect in the table as well.

You can use append structures in ABAP programs just as you would any other structure.

Note: When you copy tables that have append structures attached to them, the fields that were found in the append structure of the original table become part of the actual body of the target table.

Some of the tables and structures delivered with the R/3 standard contain special include statements calling Customizing includes. These are often inserted in those standard tables that need to have customer-specific fields added to them.

In contrast to append structures, Customizing includes can be inserted into more than one table. This provides for data consistency throughout the tables and structures affected whenever the include is altered.

Customizing include programs are part of the customer namespace: all of their names begin with 'CI_'. This naming convention guarantees that nonexistent Customizing includes do not lead to errors. No code for Customizing includes is delivered with the R/3 standard.

You create Customizing includes using special Customizing transactions. Some are already part of SAP enhancements and can be created by using project management (see the unit on 'Enhancements using Customer Exits').

The Customizing include field names must lie in the customer namespace just like field names in append structures. These names must all begin with either 'YY' or 'ZZ'.

When adding the fields of a Customizing include to your database, adhere to same rules you would with append structures.

<b>Field Exits:</b>

Field exits take you from a screen field with a data element reference to a function module. Field exits can be either global or local.

Field exit function modules adhere to the following naming convention:

prefix: FIELD_EXIT_

name: <data element name>_

suffix (optional): 0 to 9, A to Z

<b>Text Enhancements:</b>

Possible text enhancements include customer keywords and customer documentation of data elements.

Text enhancements differ from other application enhancements in that they take effect globally in all related SAP applications after activation (global enhancements).

Possible text enhancements include customer keywords and customer documentation of data elements.

Text enhancements differ from other application enhancements in that they take effect globally in all related SAP applications after activation (global enhancements).

Use the project management function to edit text enhancements.

Just as with field exits, use the menu entry Global enhancements to access the enhancement functions for keywords and data element documentation

SAP application programmers define keywords in different lengths and a short description for each data element. Use the project management function (transaction CMOD) to change these keywords and short texts.

All screen fields that use the keyword text of data elements can be renamed in this manner.

A new short text in a data element will show up in the F1 help of the screen field.

In order for keyword changes to take effect on a screen, SAP application programmers have to maintain the MOD attribute (keyword modification indicator) of the affected field accordingly in the Screen Painter field list.

The MOD attribute must have one of the following values:

SPACE: the keyword that best fits the field length 1: short keyword 2: medium keyword 3: long keyword 4: keyword for header V: variable text transfer from the ABAP Dictionary F: fixed, no text transfer

If the attribute contains an 'F', it is fixed on the screen and cannot be modified. In all other cases, screens that refer to that particular data element will show the changed keyword.

<b>SAP Application Enhancement</b>

Application enhancements allow customers to enhance their application functions. Customer exits are preplanned by SAP and generally consist of several components.

Application enhancements are inactive when delivered and can be completed and activated by customers as they are needed.

Application enhancement characteristics:

Each enhancement provides you with a set of preplanned, precisely defined functions.

Each interface between SAP and customer functions is clearly defined.

As a customer, you do not need in-depth knowledge of how to implement SAP applications.

You do not need to adjust enhancements at upgrade because of new functions that SAP has developed.

<b>Customer Enhancement Projects</b>

SAP application programmers create SAP enhancements in transaction SMOD using function module exits, menu exits, and screen exits.

Customers are given a catalog containing an overview of existing SAP enhancements. They can then combine the SAP enhancements they want into an enhancement project using transaction CMOD.

SAP enhancements are made up of component parts. These components include function module exits, menu exits, and screen exits. A specific component may be used only once in a single SAP enhancement (this guarantees the uniqueness of SAP enhancements).

Customer enhancement projects consist of SAP enhancements. Each individual SAP enhancement may be used only once in a single customer enhancement program (this guarantees the uniqueness of a customer project).

SAP application programmers preplan function module exits, menu exits, and screen exits for their applications and combine them to create useful enhancements for the R/3 System.

Customers create their own enhancement projects for their systems using SAP enhancements. You can customize the individual components of an enhancement project by creating your own include programs (for function module exits), texts (for menu exits), and subscreens (for screen exits).

<b>Customer Exits</b>

Function Module Exits

Menu Exits

Screen Exits

<b>Function Module Exits</b>

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.

<b>Menu Exits</b>

Menu exits add items to the pull down menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications.

SAP creates menu exits by defining special menu items in the Menu Painter. These special entries have function codes that begin with "+" (a plus sign). You specify the menu item’s text when activating the item in an add-on project.

<b>Screen Exits</b>

Screen exits add fields to screens in R/3 applications. 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.

<b>Implementation of Enhancement in Customer System</b>

First, use the project management function to choose the SAP enhancements that you want and create an enhancement project.

Next, edit your individual components using the project management function and document the entire enhancement project.

Finally, activate the enhancement project (this activates all of the project's component parts).

<b>Creating Customer Enhancement Projects</b>

Start the project management function (transaction CMOD) and give your enhancement project a name. SAP recommends that you think up a naming convention for all of your projects. You can, for example, include the project's transaction or module pool in its name. All enhancement project names must be unique. Next, branch to the project's attributes and enter a short text describing the enhancenent project. The system inserts all of the project's other attributes (such as created by, created on, or status).

<b>Assigning SAP Enhancement to customer projects</b>

Use the project management function (transaction CMOD) to assign SAP enhancements to customer enhancement projects. Enter the names of the SAP enhancements you want to use on the appropriate screen.

The search function gives you a catalog-like overview of existing SAP enhancements. From there you can select those enhancements that are of interest to you.

<b>Editing Components

Activating Enhancement Projects</b>

Use the product management function to edit the components of your enhancement project.

Depending on whether the component you are editing is a function module, a menu entry, or a subscreen, you branch to either the Function Builder, a dialog box for entering menu entries, or to the Screen Painter.

Activation of an enhancement project affects all of its components. After successful activation, the project has the status active.

During activation, all programs, screens, and menus containing components that belong to the project are regenerated (programs at the time they are executed). After activation, you can see the enhancements in your application functions.

The Deactivate function allows you to reset an enhancement project's status to inactive.

<b>REWARD IF USEFULL</b>

raymond_giuseppi
Active Contributor
0 Kudos
123

Look at this documentation <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBCEX/BCDWBCEX.pdf">Changing the SAP Standard (BC)</a>

Look also at the following blogs <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/advancedsearch?query=userexitBADI+&cat=sdn_weblog">SDN Blogs on Exit and BADI</a>

Regards