Showing posts with label Extensions. Show all posts
Showing posts with label Extensions. Show all posts

Friday, November 5, 2010

1. Go to the TCode SE24 and enter CL_EXITHANDLER as object type.
2. In 'Display' mode, go to 'Methods' tab.
3. Double click the method 'Get Instance' to display it source code.
4. Set a breakpoint on 'CALL METHOD cl_exithandler=>get_class_name_by_interface'.
5. Then run your transaction.
6. The screen will stop at this method.
7. Check the value of parameter 'EXIT_NAME'. It will show you the BADI for that transaction.


Source: http://searchsap.techtarget.com/tip/0,289483,sid21_gci1305858,00.html

BADI's - Business Add Ins

BADI's (Business ADd Ins) are a new type of extension introduced in SAP R/3 release 4.6c. They are based in ABAP Objects: they are classes with different methods which can be modified by customers. Their goal is to let customers meet their requirements by adding non standard code in the standard system.

Basics

BADI's have two views: the definition view and the implementation view. SE18 is the transaction to access BADI's definition view. In this view, the basic characteristics of the BADI are set: input and output parameters, type of BADI, etc. In the implementation view, which is accessed via transaction SE19, you can see the how the definition was implemented; that is, the methods that have been used, the code inserted in them, etc. In transaction SE19 you can see all the implementations of a specific BADI definition.

BADI's definitions come with the standard SAP System. It is not common to create definitions for the user. In the definition, the capacity of multiple implementations is set: single if only one implementation can be created (like in User Exits) or multiple. You can also set the filters for the BADI; this is used, for example, to create localizations if you filter by country. This is why the SAP System includes many BADI implementations.

It is also possible to create industry specific extensions for specific business types (oil industry, pharmacy, etc). This is possible because BADI's have a multilayer architecture (SAP, partners, customer solutions, localizations, industry specific solutions, etc) in contrast with User Exit, which is double layer (SAP and Customer solutions).

Method for finding BADI's

To find a BADI that may be useful for a specific goal, you can use the following method:

Insert a BREAK-POINT in the method GET_INSTANCE of class CL_EXIT_HANDLER (in transaction SE24). Then execute the program or transaction of your interest; when execution stops in the BREAK-POINT you can see BADI names in the exit_name variable. This method will make execution stop a lot of times because this method is executed very often, and not all of the BADI's you will get are useful. Nevertheless, it is a very useful method.

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_. 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.