Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how badi will be triggered?

Former Member
0 Kudos
708

how badi will be triggered?

2 REPLIES 2

Former Member
0 Kudos
207

Hi Aravind,

Each BADI has a definition & implementation associated. There can be multiple implementations for a given BADI in system.

BADI definition will be predefined in standard SAP transactions. If any implementation is done for custom code, which is active one then the BADI will be triggered automatically for this active implementation. If multiple active versions are there and no filter is used for BADI then all the active versions will be triggered.

To restrict this, filter can be used. This filter than decides at run time, depending on value, which active implementation to trigger. Find the following link for more details of multiple implementation call -

Hope this sort out your query.

PS If the answer solves your query, plz close the thread by rewarding each reply.

Regards

Former Member
0 Kudos
207

Hi,

BADI

BADI(Business Add-In) is the object oriented method of user exits...

Each BAdI has a definition and more than one implementation. The definition means the methods(in class concept) that are used for performing various functions. The BAdI definition can be viewed in SE18 transaction(for standard ones) and user-defined BAdIs can be created in the same transaction as well.

When you create a BAdI definition, an class interface will be automatically created and you can define your methods in the interface. The implementation of the methods can be done in SE19 transaction .

YOu can go through these links...

http://esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf

http://esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt

http://esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc

http://esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc

http://esnips.com/doc/365d4c4d-9fcb-4189-85fd-866b7bf25257/customer-exits--badi.zip

http://esnips.com/doc/3b7bbc09-c095-45a0-9e89-91f2f86ee8e9/BADI-Introduction.ppt

Consider the following example...

Here we have created the Filter Dependent BADI 'z_delta_7_badi_prg2'.

and created Implementation for the same in which we define the method as follows:


Method ZIF_EX_DELTA_7_BADI_PRG2-GET_BURKS.
IF FLT_VAL = ‘0001’.
            Z_TAX_RATE = ‘0.15’.
ELSEIF FLT_VAL = ‘1000’.
           Z_TAX_RATE = ‘0.20’.
ENDIF.
Endmethod.

This method was defined while creating the BADI, and its method was written in Implementation.

REPORT z_delta_flt_val_demo.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER : p_burks LIKE t001-burks.    “Parameter for company code
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

  DATA: l_badi_instance TYPE REF TO zif_ex_delta_7_badi_prg2,
  l_tax_rate TYPE string.

*Call BADI within the Program
  CALL METHOD cl_exithandler=>get_instance   
    EXPORTING
      exit_name = 'z_delta_7_badi_prg2'
    CHANGING
      instance  = l_badi_instance
    EXCEPTIONS
      OTHERS    = 1.

*Call Method GET_BURKS Passing the Company Code and Tax Rate is *returned
  CALL METHOD l_badi_instance->get_burks
    EXPORTING
      flt_val    = p_burks
    IMPORTING
      z_tax_rate = l_tax_rate.

  IF l_tax_rate IS INITIAL.
    WRITE:/ 'Tax Rate Not Returned For Company Code: ', p_burks.
    EXIT.
  ELSE.
    WRITE:/ 'Tax Rate For Company Code: ', p_burks 'is' , l_tax_rate.
    EXIT.
  ENDIF.

And in main program we will call BADI as shown above.

Regards,

Ranjit Thakur.

Please Mark The Helpful Answer.