2008 May 14 2:37 PM
2008 May 14 2:39 PM
user exits is the 'old' way of enhancing standard SAP. BAdI's is the object oriented approach.
2008 May 14 2:39 PM
user exits is the 'old' way of enhancing standard SAP. BAdI's is the object oriented approach.
2008 May 14 3:00 PM
Hi Tanoj,
USER EXITS are FORMS and are called by SAP standard programs using PERFORM.
Inside the form (user exit) you can read and change almost any global data from host program.
User exits are more flexible because you have more information to use in your code but on the other hand , it is very easy to manipulate erroneously global data and lead the standard program to a dump or even to make database inconsistent.
User-exit doesnt have any classification.
Basically designed For SD module
User-exits can be written only using access-key
With user-exits the code , the developer has written will not be there for next version unless modification assistance tool is used
BADI's
Business Add-Ins are a new SAP enhancement technique based on ABAP Objects.
Badis allow for a multi-level system landscape (SAP, partner, and customer solutions, as well as country versions, industry solutions, and the like). Business Add-Ins can be created at each level within such a system infrastructure.
Some BADI can have multiple independent implementations which is much better for software deployment as several developers can implement the same BADI independently.
Rewar points if useful.
Cheers,
Swamy Kunche
2008 May 15 2:17 PM
2008 May 15 2:39 PM
Hi Tanoj,
Check out this link.
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 allready 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"
Reward points if useful
Thanks,
Swamy Kunche
Edited by: Swamy Kunche on May 15, 2008 3:41 PM
2008 May 14 3:44 PM
Hi tanuj joshi ,
User Exits:
User exits are actually empty subroutines that SAP developers provide for you. You can fill them with your own source code.They will be in the following form.
Example: Program SAPM45A
Include M45AFZB
These was one of the enhancement technique used earlier and implemented for the sd module.
The SAP developer creates a special include in a module pool. These includes contain one or more subroutines routines that satisfy the naming convention userexit_<name>.
This technique has one major disadvantage i.e you can modify the global parameters.
i.e you can access the global values and you can change the values in them.This will create errors in the global values.
So inorder to restrict the global variables access SAP has developed the customer exits concept.
He used function modules concept in this there by restricting the global variables access .
i.e when you are using a function modules you can access the variables that are only defined in the import , export ,tables or changing parameters therby restricting the access to global variables.
You can view the customer exits in SMOD tcode.
BADIs
BADIs are the first object-oriented way of implementing the enhancements.
Customer exits have a disadvantage that they can be implemented only once.
This was overcomed in BADIs
In order to enhance a program, you must first define a Business Add-In. The application developer creates an interface for the add-in. From this, enhancement management creates an adapter class that implements the interface and thus provides the interface for implementation by the customer, partner, and so on. The developer then creates an instance of the adapter class in the application program and calls the corresponding method at the appropriate time.
For each Business Add-In you have one interface and an adapter class that implements this. The interface is implemented by the user.
The generated class (Add-In adapter) has the following tasks:
Control
The adapter class calls the active implementations.
Filtering
If a Business Add-In is to be executed only under certain conditions, the adapter class ensures that only certain implementations will be executed.
This concept ensures mutlple use. Any Business Add-In that has been implemented once already can be implemented again by those groups listed to the right of the software chain shown in the above graphic.
Customers can find the enhancements in their system in the Implementation Guide (IMG) and in the component hierarchy. If a customer wishes to use a Business Add-In, he or she first creates an implementation. The customer must implement the methods and the enhancements, and afterwards activate the implementation of the enhancement. The enhancement's active components are then called at runtime.
Normally, a Business Add-In contains an interface and other additional components such as function codes for menu enhancements. In some cases, Business Add-Ins also include enhancements for screens. The enhancement, interface, and generated classes are all located in the appropriate application development namespace. Business Add-In implementations are created in the respective implementation namespace.
Hope its useful.
Reward points if useful
Thanks ,
Surya Pydikondala.
2008 May 14 3:53 PM
Hi
http//www.sap-img.com/abap/difference-between-badi-and-user-exits.htm
2008 May 14 4:17 PM
2008 May 15 2:55 PM
Hi tanuj joshi ,
Check out the following scenario regarding User Exit
In VL01 - Create Delivery Order, standard program SAPMV50A, the standard program did not check for storage location equal to space, and delivery quantity less than one when the user click the save button.
Therefore I have to insert the additional checking into the userexit routine.
Steps:-
1.Goto transaction VL01 to pick a Sales Order for delivery (you don't have to save the data)
2.In the initial screen, click System -> Status ->
3.In this you will get the status screen. Double click on the program name for the particular transaction(VL01)
4.Program SAPMV50A will be displayed.
In the dialog program SAPMV50A, click Edit -Search/replace
Type the string userexit in the Find field, then click the In program radio button and hit Enter
5.A number of userexit routine will be display. You'll have to roughly decide which is the correct userexit routine to used based on the short description provided..
userexit_save_document_prepare is the subroutine suiting our requirement
Double click on the user exit.
change the status from display mode to change mode and write the pseudo code there.
For changing the status from display mode to change mode u need an access key.
and write the code in the exit
form userexit_save_document_prepare.
case xlips-pstyv.
when 'TAX' or 'REX'.
* Accept this two Delivery item category
when 'REN'.
if xlips-lgort = space.
* Reject this Delivery item category
message e001.
endif.
when others.
if xlips-matnr <> space.
* Check storage location not space
if xlips-lgort = space.
message e002.
endif.
* Check delivery quantity not zero
if xlips-pikmg < 1.
message e003.
endif.
endif.
endcase.
endform. Save and Activate the program and check whether the conditions are satisfied or not by creating a sales order.
Hope its useful.
Reward points if usefull.
Thanks,
Surya Pydikondala.