BADI for SAP ABAP Three

A business add-in has two important attributes that you must define:

Reusable
Filter-dependent

If you want the business add-in to support multiple parallel implementations, select Reusable. The sequence in which the implementations will be processed is not defined. Even if the business add-in does not support multiple use, you can still have more than one implementation for it. However, only one implementation can be active at a time.If you make a business add-in filter-dependent, you can make calls to it depending on certain conditions. You must specify the filter type in the form of a data element. The value table of the domain used by the data element contains the valid values for the implementation.When the enhancement method is called, a filter value must be passed to the interface.

You can include function codes in a Business Add-In definition (similarly to menu exits in customer exits). To do this, enter the program name and function code, and a short description in the relevant fields.

Restrictions:

It is not currently possible to create BAdIs that consits only of menu enhancements (function codes).If you use menu enhancements, you cannot reuse a BAdI or make it filter-dependent.The system proposes a name for the interface and the generated class. You can, in principle, change the name of the interface to anything you like. However, your BAdI will be easier to understand if you retain the proposed name.

The name of the generated class is composed as follows:

  1. Namespace prefix
  2. CL_ (to signify a class in general)
  3. EX_ (stands for "exit")
  4. Name of Business Add-In

If you double-click on the interface name, the system switches to the Class Builder, where you can define the interface methods.A BAdI interface can have several interface methods.

You can use all of the normal functions of the Class Builder. For example, you can:

  1. Define interface methods
  2. Define interface parameters for the methods
  3. Declare the attributes of the interface

If the business add-in is filter-dependent, you must define an import parameter flt_val for each method. Otherwise, you define the interface parameters you need for the enhancement.Once you have finished working on your interface, you must activate it. This generates the adapter class for the Business Add-In.

If you change the interface, the adapter class is automatically regenerated.You can also generate the adapter class explicitly at any time by choosing Utilities -> Regenerate from the initial screen of the Business Add-In maintenance transaction.


To call a business add-in method in an application program, you must include three statements in the program:

Declare a reference variable (1) with reference to the business add-in interface (in our example, "exit_ref").Call the static method GET_INSTANCE of the service class CL_EXITHANDLER (2). This returns an instance of the required object. This involves an implicit narrow cast, so that only the interface methods of the object with the reference variable "exit_ref" can be addressed.You can now call all of the methods of the business add-in. Make sure you specify the method interfaces correctly.

If your Business Add-In is filter-specific, you must pass an appropriate value to the parameter flt_val.

Business add-ins are a natural extension of the conventional enhancement technique. They have taken over the administration layer from customer exits, along with the availability of the various enhancement components.They adopted the idea of re usability from Business Transaction Events, and have been implemented using a consistent object-oriented approach.The object-oriented implementation provides previously unavailable opportunities. For example, it would be possible to enhance the object "Document". It would be possible to provide a new instance of the enhancement for each individual document.

The components in parentheses in the graphic have not yet been implemented:

Screen enhancements
Table enhancements

These enhancement components are planned for later releases. There will then also be a migration tool for converting previous enhancements into the new form.


RELATED POSTS

BADI PART 1
BADI IN BRIEF
SAP Full form and introduction part two
SAP architecture,its full form of working and enjoy sap products

No comments :

Post a Comment