Vous êtes sur la page 1sur 11

http://www.newtosap.info/2012/11/enhancements-in-sap-abap-introduction.html http://saptechnical.com/Tutorials/Others/EnhancementFramework/demo.htm http://wiki.sdn.sap.com/wiki/display/ABAP/Enhancements+Types http://sapignite.com/enhancement-in-sap-how-to-find-work-and-implement/ what is enhancement in sap http://www.newtosap.info/2012/11/enhancements-in-sap-abap-introduction.html http://sapbrainsonline.com/userexits-tutorial/sap-user-exits-and-enhancement.html what is user exit in sap http://scn.sap.com/docs/DOC-29212 http://scn.sap.

com/thread/431441 http://wiki.sdn.sap.com/wiki/display/ABAP/Enhancements+(User+Exits+and+Customer+exits) http://www.saptechies.com/user-exits_1/ http://www.allinterview.com/showanswers/23629.html

Enhancements What is enhancement? Some times standard programs may not full fill our requirements at the time we will add our custom logic to the standard programs. Generally we should have to add custom logic to standard programs. With out effecting to standard programs, which known as enhancement . In sap we cant enhance all standard programs. We can enhance only those objects which has enhancement provisions.

Types of Enhancements

1. 2. 3. 4.

There are four ways of doing enhancements in sap. User Exits Customer Exits BADIS (Business Add-Ins) Enhancement Frameworks a) Implicit Enhancement b) Explicit Enhancement

User-Exits User exits 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. These user exits are generally collected in includes and attached to the standard program by the sap. User exits are a type of system enhancement that was originally developed for the R/3 SD module. User exits are empty subroutine that sap developers have provided for you. you can fill them with your own source code. technically this is a modification.[not enhancement]

Draw-Backs of user-exits It requires Access key. Implementation of user exits can not be upgrade from one version to another version. Only SD module support this kind of enhancement. Due to above draw-backs user exits were modified as customer exits.

user exits start with All user exits start with the word USEREXIT_..... FROM USEREXITS_XXXX.. INCLUDE ZZUSEREXIT ENDFROM.

How to find user-exits User exit can be found in number of ways: to find user exits in SD module ,go to object navigator (se80) and select development class from the list and enter VMOD in it. All of the user exits in sd are contained in the development class VMOD.press enter and you will find all the includes which contains user exits in sd for different functions like sales order,Delivery,Billing,Pricing etc.select the user exit according to the requirement and read the comment inserted in it and start coding.

Examples: In User exits MV45AFZZ(Sales Order Exit), we have subroutine USEREXIT_PRICING_PREPARE_TKOMK USEREXIT_PRICING_PREPARE_TKOMP This user exit can be used to move additional fields into the communication table which is used for pricing. TKOMK for header fields and TKOMG for item fields. The fields which are not in either of the two tables KOMK and KOMP cannot be used in pricing.

How to work with user exit.

A user exit is a place in a software program where a customer can arrange for their own tailormade 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.

Customer-Exits These are modified user-exit. Sap creates customer exits for user specific programs , screens , and menus within standard applications. These exit do not contain any functionality. Instead , the customer exits acts as hooks. You can hang your own add-on functionality onto the hooks. These support PROCCEDURAL TYPE approach.

These use EMPTY FUNCTION MODULES. To implement customer exits access key is not required. Implementation of customer exit will not affect the main program, since it is using F.Ms. Customer exits are nothing but a include in customer name space will be provided in the function module which starts with CALL CUSTOMER. You can fill them with your own source code. Technically this is an enhancement. User exits generally refer to SD module while customer exits refer to all modules like MM, SD, PP, FICO etc.

NOTE: Only one implementation for function exit is possible here. Advantage & Disadvantage of user exits Advantage: 1) They do not affect standard SAP source code 2) They do not affect software updates Disadvantage: Customer exits are not available for all programs and screens found in the SAP System. You can only use customer exits if they already exist in the SAP System.

How to find the Enhancement Go to SMOD. Press F4 in the Enhancement field. In the next popup window, click pushbutton SAP Applications. A list will appear that contains information on all the enhancements, categorized under functional areas. Developer must search for the enhancements relevant to his functional area of interest for e.g., Purchasing, Asset Accounting, etc.

Note down the enhancements. Then, come to the initial screen of SMOD and view the documentation of each enhancement to find out which one is required for your development. As an example take BATCHCHK and open it in SMOD transaction .you can see that it can be used for the Batch validation.

Types of customer-exits 1) Function Module exits 2) Screen exits 3) Menu exits

Function Module Exits It is used to add extra custom program lines for a standard program. Function module exits are exits developed by SAP. The exit is implemented as a call to a function module.

The code for the function module is written 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.

Format: CALL CUSTOMER-FUNCTION '910' The naming standard of function modules for function module exits is: EXIT_<program name>_<3 digit suffix> Screen-Exits Here we add custom sub screen to the standard screen. Allow customer to add fields to a screen via a sub screen in an SAP program. The sub screen is called within the standard screen's flow logic.

Format: CALL CUSTOMER-SUBSCREEN CUSTSCR1 Menu-exits Here we can add custom menu items for standard menu bar. Menu exits allow you to add your own functionality to menus. Menu exits are implemented by SAP and are reserved menu entries in the GUI interface. The developer can add his/her own text and logic for the menu. Function codes for menu exits all start with "+". Format: +CUS (additional item in GUI status)

Method to find out customer exits Basically we have three ways to search for a exit.

Using call customer function Using SMOD tcode. Using se84 tcode.

Method1: Using call customer function Go to se93. Give the tcode name Ex:- xd01. Click on display Double click on the program name. Click on the find button .

A pop up is displayed. Give the string as call customer.