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: 

userexits

Former Member
0 Kudos

hi abapers,

where can i get complete details about userexits with small examples plz send me its very urgent

3 REPLIES 3

Former Member
0 Kudos

Hi jagadesh,

go to wikis in sdn..search for user exits...you get lot of material ..

for more pls check the following links...

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

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

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

for 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

pls reward if helps,

regards..

Edited by: dinesh kumar on Jan 27, 2008 7:46 PM

Former Member
0 Kudos

Hi,

User exits allow you to add additional functions to the SAP standard.

Programs with user exits contain subroutine calls at certain points in their syntax that are identified by the prefix USEREXIT. The actual user exits are located in an include that has been assigned to a module pool. This is where customers can include any changes (enhancements) that they want to make to the system. These includes are always processed during program flow.

Advantage: In principle, customers can modify anything they want that is found in the include (tables, structures, and so forth).

Disadvantage: SAP cannot check the individual enhancements themselves which often leads to errors in the enhancement process.

The following is one example I found in Net erlier:

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"

Regards,

Renjith Michael.

Former Member
0 Kudos

User Exits are also called as BADI's (Business Aditions)

There are two steps in User Exit creation.

1} Identify the User Exit suitable for the requirement and that is available in the system:

Code SE18 is used to Identify the BADI available.

Look for the string 'CL_EXITHANDLER' in the standard program. This is a class which has a method 'GET_INSTANCE' which is used to trigger BADI's from the Standard Program. The interface parameter for this static method 'EXIT_NAME' is used to pass the BADI to the method.

Open Standard Program and do a global search 'CL_EXITHANDLER'.

SE18 > give the BADI name found through above search.

CUSTOMER_ADD_DATA > which has a method SAVE_DATA.

2} Implement the User Exit identified through above process.

T.Code SE19 is used to Implement BADI.

SE19 > give the implementation name > Give the Definition name as CUSTOMER_ADD_DATA and the Short Text.

Intro.....

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm

Check these links for info about badi..

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

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

http://www.esnips.com/web/BAdI

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

check any fo the below links. this will def help u.

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

And also download this file....

http://www.savefile.com/files.php?fid=8913854

There are other tutorials on this site...

http://sapbrain.com/Tutorials/tuto_download.html

What are BAdIs?

-> is an anticipated point of extension – these points act like sockets and exist in the original source code

-> based on ABAP Objects. BAdI defines an interface that can be implemented by BAdI-implementations that are transport objects of their own

->Important! There are 2 roles: Enhancement Option-provider & Implementer.

-> In the above context, Enhancement Implementation can be done only if option (hook) is provided by the Option-provider. In simple words there are no implicit BAdIs.

Note: In the following slides, Definitions are created so as to understand the method of BAdI definition & for example purpose. As stated above this is the role of Enhancement Option-Provider.

Classic BAdIs already exist since SAP Release 4.6

BAdIs have been Re-implemented in ECC7.0 under the new Enhancement Framework & Switch Framework

Classic BAdIs

To understand what a powerful pattern a BAdI is, we will now define & then implement a BAdI

BADI Class is created automatically.

The various options are described below in detail:

1. Enhanceable: Enhanceability of filter types can only be specified for filter-dependent BADI definitions under very special conditions. For example, the domain belonging to the filter type must be linked with a value table that is of the type E or G. A BADI implementation can then be created in one step by creating a new filter value that is automatically entered into the value table at save and also copied into the transport order of the BADI implementation. In addition, it is also possible to create a new filter value and, at the same time, a BADI implementation with the same name. Naturally, you can also specify existing filter values.

You should select this feature if there is a prerequisite that a new filter value is created together with a new BADI implementation - that is, that BADI implementations are not created solely with existing filter values, although this, too, is possible.

2. Multiple-Use

3. Filter-Dependent

Instance Methods can access all of the attributes of a class and can trigger all events of a class. Static Methods can only access static attributes and static events.

Exceptions:

Events:

Events can be defined in classes or in interfaces. Corresponding methods can trigger these events with the RAISE EVENT statement. Each class (or interface) that is going to handle the corresponding event must implement a relevant handler method, and register it using the SET HANDLER statement. When an event occurs, the system calls all of the handler methods registered for that event.

Like method definitions, events have a parameter interface. The only difference is that events may only have EXPORTING parameters.

BADI : Businees Add IN's

Business Add-Ins are SAP enhancement technique based on ABAP Objects.

Where the SAP standard program is not going to fullfill the client requirement , we are going to add our own program to SAP standard program, without changing the standard prog.

Each Business Add-In has

– at least one Business Add-In definition

– a Business Add-In interface

– a Business Add-In class that implements the interface

Each BADI has two different Views.

1.Definition view

2.Implementation view

T.C for BADI Definition is SE18.

T.C for BADI Implementation is SE19.

There are multiple ways of searching for BADI.

• Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE

• Finding BADI Using SQL Trace (TCODE-ST05).

• Finding BADI Using Repository Information System (TCODE- SE84).

1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.

Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.

The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.

2. Start transaction ST05 (Performance Analysis).

Set flag field "Buffer trace"

Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)

Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.

Push the button "Deactivate Trace".

Push the button "Display Trace".

The popup screen "Set Restrictions for Displaying Trace" appears.

Now, filter the trace on Objects:

• V_EXT_IMP

• V_EXT_ACT

Push button "Multiple selections" button behind field Objects

Fill: V_EXT_IMP and V_EXT_ACT

All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.

So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA

3. Go to “Maintain Transaction” (TCODE- SE93).

Enter the Transaction VD02 for which you want to find BADI.

Click on the Display push buttons.

Get the Package Name. (Package VS in this case)

Go to TCode: SE84->Enhancements->Business Add-inns->Definition

Enter the Package Name and Execute.

Here you get a list of all the Enhancement BADI’s for the given package MB.

Have a look at http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/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

Rewards if useful.