Kernal Vs Classic Badi
Kernal Vs Classic Badi
Fallback Class:
The Fallback option is used if no BAdI implementation with suitable filter conditions and no standard
implementation are found.
1.3. Specify a name of Enhancement spot and a short description. Optionally, you
can assign the new spot to an already existing composite enhancement spot.
2.1. Now create a BAdI within the Enhancement spot, click on create BAdI definition icon as
shown below.
2.3. Enter a name and a short text for the BAdI Definition.
2.3. The new BAdI appears as a node in the tree display of the tab page.
2.4. Deselect the Multiple Use check box.
3. Create a Interface:
Methods are defined in the interface which determines what use you can make of your BAdI.
3.1. Expand the BAdI node and click on the Interface as shown below.
Note:
We have created a single use BAdI, Now if we the run the Application Program it dumps because
there should be one active implementation for a single use BAdI.
The Fallback option is used if no BAdI implementation with suitable filter conditions and no
standard implementation are found.
4.1. Enter a name for the Fallback Class and press enter.
5. Implement Class:
After the BAdI definition and implementation, BAdIs can be called using a combination of the
ABAP statements GET BADI and CALL BADI.
* Parameter Declaration..............................
PARAMETERS:
p_value1 TYPE i,
p_value2 TYPE i.
* Data Declaration.......................................
DATA:
w_handle TYPE REF TO zbadi_fallback_def,
w_result TYPE i.
* GET BADI - for getting objects..................
GET BADI w_handle.
Another Example 2:
Scenario: For a BADI definition if some BADI Implementations are exist then all the active BADI
implementations are called during run time. If all the BADI implementations are inactive or does not
exist then if there is any fallback class exist then it is called during runtime. The FALLBACK class is a
default implementation of BADI definition which is called if all the BADI implementations are inactive
or none of the BADI implementation exists.
Step6. Provide the BADI definition name and the description and at last click on the Continue button.
Step7. Some of the BADI definition properties are Multiple use.
Step8. Expand the BADI definition, click on the Interface element from the left hand side. Then
provide the Interface name 'ZIF_SHOW_MESSAGE' in the right hand side and then double click on it.
A popup will appear stating to create the same . Click on YES button to create it.
Step9. Now provide a method description and activate it and go back.
Step11. Create a BADI Implementation. Expand the BADI definition in the L:H:S. Select the
Implementation and click on the highlighted button to create the implementation.
Step12. Now provide a Enhancement implementation name and description and click on the continue
button.
Step13. Now provide the BADI Implementation name, description and the implementing class name
and click on the continue button.
Step14. Now expand the BADI implementation form the L:H:S and click on the Implementing class to
implement the method.
Step15. Now double click on the Method Name to implement it.
Step17. Provide some in the method and activate it. At last click on the BACK button .
Step18. Now one BADI implementation is created for the BADI definition.
Step19. Go to SE38 to create a report and calling the BADI implementation. Provide the Report name
and click on the Create button.
Step23. Deselect the check box and activate the Enhancement implementation.
Step24. Now again run the program.
Step35. Go to the BADI implementation and activate it again by selecting the check box.