Saturday, 26 October 2013

Use of BADI FallBack Class

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.

Step1. Go to TCODE-SE20. Create a Enhancement Spot.









Step2. Provide a Enhancement spot name and click on the Create button.


 Step3. Provide a short text and click on the continue button.



Step4. Save in local object.



















Step5. Create a BADI definition. Activate the enhancement spot and click on the create button to create a BADI Definition.
















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.












Step10. Activate it.












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.











Step16. click on YES to continue.














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.

















Step20. Provide the below code. activate it and RUN it.














Step21. The Active Implementation is called.












Step22. Go to the BADI implementation .
















Step23. Deselect the check box and activate the Enhancement implementation.
















Step24. Now again run the program.














Step25. The output is as shown below. As the BADI implementation is inactive.













Step26. Now go to the BADI Definition.




















Step27. Select the check box and provide a fall back Class name and double click on it. From the popup click YES to continue.






















Step28. Now double click on the method to implement it.













Step29. Provide some statement and activate it. At last click on  BACK button.






Step30. Now activate the class and go back.












Step31. After this the Enhancement spot is inactive.




















Step32. Activate the enhancement spot.




















Step33. Run the Report.














Step34. The output is as shown below. As the BADI implementation is Inactive and the FALLBACK class is exists.














Step35. Go to the BADI implementation and activate it again by selecting the check box.
















Step36. Now run the report.
















Step37. The output is as shown below.
















_________________________________________________________________________________

2 comments:

Unknown said...

Awesome Tutorials But Please Provide Some Tutorials on BAPI's , User-Exits and Customer-Exit As these Topics are hindrance to make this blog the Excellent blog Hope you will Publish as soon as Possible as Your blog is really helpful blog and nice blog

Unknown said...

GREAT

Comments system

Disqus Shortname