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

Hi Friends,

I would like to know more about user exits.Could anyone help me in those concepts like

1. how to find out the user exits for a particular module.

2.Why do we user user exits?

And if Possible please send me any documents which gives any example with explanation.

My email-id : rinky.1234@gmail.com

1 ACCEPTED SOLUTION

Former Member
0 Kudos

To get more information about user exits, run transaction CMOD and press the "I" button to get the documentation.

If you search the forum, you'll find examples of programs that find exits for a transaction.

Rob

5 REPLIES 5

Former Member
0 Kudos

To get more information about user exits, run transaction CMOD and press the "I" button to get the documentation.

If you search the forum, you'll find examples of programs that find exits for a transaction.

Rob

Former Member
0 Kudos

Whew, Tina,

this is a big issue. Let me contribute some general aspects where others might come up with some more details or some document references.

To modify the system behaviour, that cannot be done with customizing there are various types of enhancement that can be implemented, mostly done with the ABAP/4 programming language:

- User Exits

- Business Transaction Events

- Business Add-Ins

- SAP Business Workflow

<b>1) User Exits</b>

This was the first possibility to modify the system very early releases (of R/2 and R/3)

There are two subkinds of user exits:

1.1 Exit-Includes within a main program

1.2 Funcion-modules exits in customer's namespace domain

<u><i>1.1 Exit Includes</i></u>

Let's take for example the program SAPMV45A that is responsible to handle the sales order activity like creation, change and so on. It has many global variables that are available in any include that SAPMV45A include. These globals reflect the current business object in process (by the way: this is the old-fashioned style of ABAP/4 programming):

XVBAK YVBAK

XVBAP YVBAP

Where X... means the previous version and Y... the newer one. In the user exits that is part of the main program, these variables become available. This is the very distinction between this type and...

<u><i>1.2 Function-Module-Exits</i></u>

These exits are triggers or called on certain moments during the data processing, e.g. INVOICE_UPDATE which is called in the update task. These function modules have a certain interface, usually come kind of database-related structers, and only these export or changing parameters are to be modified by the user exit. This actually limits your possibilities but on the other hand is more safe to use.

<b>2. Business Transaction Events</b>

This is quite like the function-module exits. Business Transaction Events are very limited in what you can do with them, but they are very safe to use (as long as you don't do something 'bad'). They are disjoined from the currently running programming.

There are also two subtypes of BTE's, which are

2.1 Publish and Subscribe (P/S)

2.2 Process BTE's

<u><i>2.1 Publish and Subscribe (P/S BTE's)</i></u>

A function module that receives certain type of business data and you may react on this, like adding some entries into the database or something else. The P/S function module cannot change any data of the currently processed object. You can find P/S modules mostly in FI.

<u><i>2.2 Process BTE's</i></u>

These function modules receive business data and have a very limited interface with which they may change some data, e.g. SAMPLE_INTERFACE_00503102.

<b>3. Business Add-Ins</b>

This is the most recent version of system modification opportunities. Instead of implementing a function module you do implement an ABAP/4 OO class method which turns out be quite no difference to the function module exits (you could still call a function module within the object's implementation. The add-ins are usually called during the data processing, when a user is involved, at certain steps in the dialogs. In difference to the BTE's, these ones here may also be called several times, e.g. if the user goes back and forth in the transaction.

You find many of them in the HR module.

<b>4. SAP Business Workflow</b>

You can enable a workflow or workitem by certain events that are risen from the processing transactions, e.g. BKPF.Created is risen for any FI posting that has been completed. These events are /always/ processed in background so you do not have a chance to bring up a popup, are dialog or something else. The standard function module SWW_WI_CREATE_VIA_EVENT does create a workflow or workitem (entered in the maintenance table, transaction SWETYPV), but you're not limited to do so. If you like to do a certain, simple action, whenever the event happends, you can replace it with your own function that implements the same interface. Usually you have the currently processed object passed in the fields objtype (e.g. BKPF) and objkey (that usually gives you the concatenated primary key of the database object).

If there is now event available for your purposes you can also rise them by yourself in

- some other user exit, BTE,...)

- Using output messages (MM/SD/QM/...)

- Trigger them with document changes (usually master data, SD, MM, ..., mostly every application that writes them).

<u>Now which one to choose then?</u>

User exits are the old-fasioned way but many of them survived, even in the brand new releases. You cannot really consider them to be release safe. On the other hand they give you the most flexible and deeper opportunities.

Business Transaction Events are very limited in what you are allowed to do, but if you find one: take it. BTEs are also considered to be release safe.

Business Add-Ins are the most recent version and also very safe to use because they have a defined interface. When implementing a BadI you're also enforced to write some clean code because you're programming them in the ABAP OO context, so if you find one, go and use it.

If nothing else helps, use the Workflow engine. It is more complex to use but also very fine and also considered to be release safe.

I hope that I could give you a just roughly overview.

With kind regards,

Florin

0 Kudos

Hi Florin,

A million THANKS for giving an overall description about user exits.

Thank you very much for your help.

Need More assistance to work on it.

Regards,

Tina Wilson.

ferry_lianto
Active Contributor
0 Kudos

Hi Tina,

Please find the following information regarding user exits. Hope this will help.

<b>1. Introduction</b>

User 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

<b>2. How to find user exits</b>

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.

<b>3. Using Project management of SAP Enhancements</b>

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

Also please find this useful links for user exits references.

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

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

http://www.sap-img.com/abap/field-exits-smod-cmod-questions-and-answers.htm

Regards,

Ferry Lianto

former_member927251
Active Contributor
0 Kudos

Hi Tina,

I am sending you the document for the same on your Email ID.

Please award some points if it helps you.

Regards,

Amit M. Mishra