Calling Badi in the Application
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.
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
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.
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.
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
There are multiple use and single use Business Add-ins. This option can be choose at Business Add-in definition.
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.
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.
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
Difference between Business Transaction Events and BADI’s.
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.
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.
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.
Function modules are used for program enhancements in Open FI. With BAdi’s, ABAP Objects is used to enhance programs.
Difference between customer exits and BAdi’s.
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.
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
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).
We can create definitions and implementations of business add-ins at any level of the system landscape.TRE
Following are the Tables which are relevant to BAdi’s
SXS_ATTRT - BAdi Definition list
V_EXT_ACT - Active implementations of an exit
V_EXT_ IMP - Implementation class for an interface+filter
V_EXT_M - BAdi’s with filters
Transaction related to BAdi’s
SE18 - Business Add-in builder
SE19 – Implementation of Badi
SE24 – Class/Interface Builder
No comments:
Post a Comment