User Exits in ABAP


User Exits are probably the most common user enhancements in SAP. They were first created for the SD Module, but then they were extended to other SAP modules. Allthough they should be eventually replaced by BADI's or Enhancements, they will still be here for a long time.

Basics

This type of User Exit, called Function Module User Exit is, as you may imagin, a Function Module. They are called within standard progams with the ABAP statement CALL CUSTOMER FUNCTION 'XXX', where the three X are replaced by a number. This FM always belong to a FM Group that starts with an X. SAP's naming convetion for FM Exits is EXIT_caller_program_name_XXX. This instruction will only be executed if the FM Exit is activated.

Inside this FM Exits, there is a refernece to an include that starts with Z; so, in order to include customer code you will have to create and edit this include. As it starts with Z you will not be prompted for an authorization code.

There is another type of User Exit, in the SD Module, similar to FM Exits. Instead of FM, they are FORMS inside a standard program. They are called USER_EXIT_<NAME>. This subroutines are in special INCLUDES, which SAP will not modify in the future.

This type of extension is rather rudimentary, as in fact technically objects from the ABAP name area are modified.

An example of these are the exits for Sales. The standard program SAPMV45A calls several subroutines that are defined in special includes (for example, MV45AFZB and MV45AFZZ ) that users modify to their needs. This subroutines work generally with global data.

Implementing FM User Exits

In order to implement this type of extension, you will have to find which is the particular FM Exit that best fits your needs. You have to be sure that the process effectively executes the CALL CUSTOMER FUNCTION of your FM Exit. Then you must make sure that the parameters that are included in the FM are enough for your development.

Once you have checked this, you will have to activate the FM Exit. This is done via transaction CMOD: select the corresponding project and go to COMPONENTS. There, you will be able to activate th FM Exit.

Now, you just need to create the corresponding INCLUDE and insert the desired code in it.