Calling a BADI and uses

Calling Badi in the Application

  1. When we define BAdi, enhancement management generates a class that implements the interface. The application developer uses a factory method to create an instance of adapter class in the application program and calls corresponding method. The adapter class method generated by the enhancement management decide by checking the entries in the table whether one or several active implementations need to be called. If required, the implementations are subsequently executed. The application program ensures only the adapter class method is called. The application program doesn’t know which implementations are called.
  2. Call the string conversion Business Add-in, the program calling the Business Add-in. Following is the ABAP source code

REPORT ZMPTEST_BADI.
* Declaring the handler
class: cl_exithandler definition load.
* Interface Reference
data: badi_interface type ref to ZIF_EX_BUSINESSADDIN.
* String
data: w_str(15) type c value 'baddi test'.
*************************************************
****Start of Selection Event.....................
************************************************
start-of-selection.
call method cl_exithandler=>get_instance
changing
instance = badi_interface.
write: / 'Please click here'.
*************************************************
****At line-selection Event.....................
************************************************
at line-selection.
write: / 'original word', w_str.
if not badi_interface is initial.
call method badi_interface->conversion
changing parameter = w_str.
endif.
write: / 'Converted word', w_str.

Filter dependent Badi

  1. Business Add-in definition level (for example a country, industry sector) we can have filter dependent option. If an enhancement for country specific versions then it is likely that different partners can implement this enhancement. The individual countries can create and activate their own implementation.
  2. In the enhancement definition, all the methods created in the enhancement’s interface need to have filter value as their importing parameter. The application program provides the filter values for the implementation method.
  3. Filter dependent BAdi is called using one filter value only, it is possible to check active implementation for the filter value using the function module SXC_EXIT_CHECK_ACTIVE.

Multiple use Badi

  1. There are multiple use and single use Business Add-ins. This option can be choose at Business Add-in definition.
  2. The distinction is base on the procedure or event character of an enhancement. In the first case the program waits for the enhancement to return a return code. Typical example is benefit calculation in HR depending on the implementation, alternative calculations can be executed. In case of multiple use add-ins, an event that may be interest to other components in program flow. Any number of components could use this event as a hook to hang their own additional actions on to.
  3. There is no sequence control for multiple-use implementations of BAdi’s. Sequence control is technically impossible, at the time of the definition the interface does not know which implementations parameters will be change the implementations.
  4. The concept of multiple use of the Business Add-in is that has been implemented once already can be implemented again by right of the software chain.

Difference between different enhancement technique with BADI

  1. Difference between Business Transaction Events and BADI’s.
  1. The concept of the BADI is similar to Business Transaction Events (Open FI). BTE’s was developed specific to Financial Accounting module. But were as BADI’s was developed in generalised to all modules.
  2. BTE’s can only be used to make the program enhancements. You cannot enhance user interface with Open FI, but you can with Business Add-ins.
  3. Open FI assumes that enhancement can only take place on three levels i.e. SAP- partners – customers, but in case of BAdi’s you can create and implement enhancements in as many software layers as you like.
  4. Function modules are used for program enhancements in Open FI. With BAdi’s, ABAP Objects is used to enhance programs.
  1. Difference between customer exits and BAdi’s.
  1. Customer exits assume a two-tiered system infrastructure (SAP - Customers). Where as in case of BAdi’s you can created and implement enhancements in as many software layers as you like.
  2. BAdi’s are considered as generalized BTE’s that can be used to bundle program, menu and screen enhancements into a single add-in. BAdi’s can be created and employed in each of the various software levels.

Advantages of BADI’s

  1. This enhancement technique has the advantage of being based on a multi-level system landscape (SAP, country versions, IS solutions, partner, customer and so on).
  2. We can create definitions and implementations of business add-ins at any level of the system landscape.TRE
  1. Following are the Tables which are relevant to BAdi’s
SOME IMPORTENT BADI'S
  1. SXS_ATTRT - BAdi Definition list
  2. V_EXT_ACT - Active implementations of an exit
  3. V_EXT_ IMP - Implementation class for an interface+filter
  4. V_EXT_M - BAdi’s with filters
  1. Transaction related to BAdi’s
  1. SE18 - Business Add-in builder
  2. SE19 – Implementation of Badi
  3. SE24 – Class/Interface Builder

No comments :

Post a Comment