Scenario: Creating Kernel BADI definition with multiple Use and Filter condition.Creating a report program to call this BADI.
Step1. Already we have a Enhancement Spot ‘ZSIMPLE_ENHC_SPOT1’ . Now Click on the Create button(F5) to create a BADI definition.
Step2. From the POP up screen Provide the BADI name and short description and click on the continue button.
Step3. Now the BADI definition is created with name ‘ZKERNEL_BADI_DEFN_DEMO2’ with multiple
Step4. Define the interface for the BADI. Now double click on the Interface as highlighted in the left side and provide the interface name which is created earlier with one method.
Step5. Now define the filter. Select the BADI definition and click on the highlighted Icon. From the option choose Create Filter .
Step6. Now provide BADI filter as ‘country’, type as ‘C’ and the description.At last click on the continue button.
Step7. Now the BADI filter variable ‘country’ is created which appears in the right hand side.
Step8. Up to this point BADI definition with interface and filter is created. Now create the BADi implementation. Expand the BADI definition. Select the implementation and click on the cretae implementation button as highlighted.
Step9. Select the Previously created enhancement implementation and click on continue button.
Step10. From the appearing popup screen, provide badi implementation name, description and the implementing class name and at last click on the continue button.
Step11. Now provide the filter value for the badi implementation. Double click on the Filter Val. as highlighted in the left hand side.
Step12. Now click on the ‘COMBINATION’ button as highlighted on the right hand side.
Step13. Now double click on the highlighted line on the right hand side.
Step14. Provide value1 as ‘IN’, comparator1 as ‘=’ and at last click on the continue button.
Step15. Now the filter condition for this BADI implementation appears on the Right hand side.
Step16. Now double click on the Implementing class as highlighted on the left hand side of the badi implementation. Now double click on the method of the interface.
Step17. Click on YES to continue.
Step18. Provide some statement in the method. Now activate it and click on teh back button.
Step19. Now for the BADI ‘ZKERNEL_BADI_DEFN_DEMO2’ one implementation is created.
Step20. Create another BADI implementation. Select the BADI definition. Expand this, select Implementation and click on the highlighted button to create an implementation.
Step21. Select the previously cretaed Enhancement Implementation and click on the Continue button.
Step22. Now from the appearing popup screen provide the BADi implementation name, description and the implementing class. At last click on continue button.
Step23. Provide the Filter value for the BADI implementation.
Step24. Double click on the Filter. Val on the left hand side. Click on the COMBINATION button on the right hand side.
Step25. Now provide value1 as ‘US’, Comparator1 as ‘=’ and at last click on the continue button.
Step26. Now double click on the Implementing class from the left hand side of the BADI implementation and double click on the method name to implement it.
Step27. Click on YES to continue.
Step28. Provide some statement in the method. Activate it and click on the back button.
Step29. Now we created two implementations.
Step30. Now for the Particular BADI definition we have two active BADI implementations .
Step31. Go to SE38 and create a report as shown below to call the implementations and RUN it.
Step32. Now provide ‘IN’ as the country and press F8.
Step33. The BADI implementation with filter value IN is called with the following out put.
Step34. Now provide ‘US’ as the country and press F8.
Step35. The BADI implementation with filter value US is called with the following out put.
Step36. Now provide any different value as the country and press F8 and there is no output as the filter condition is not matched against any BADI implementation filter value.