Classic BADI with Multiple Use (Multiple Implementation) with Filter condition

Scenario: Creation of Classic BADI definition with multiple use and Filter. Creation of BADI implementations and calling the BADI implementations from program.

Step1. Go to TCODE- SE18.


Step2. Provide the BADI name 'ZBADI_DEFN_DEMO3' and go to the menu Utilities and Click on Create Classic BADI.

Step3. Provide a short description. In the properties section, the system automatically generates a BADI Class based on the BADI name. In the TYPE section, select multiple use option which indicates that this BADI can be used for multiple implementations and also select Filter-Depend. Provide a Filter Type as LAND1(country dependent filter). As per the information provided, the filter type should be a DATA ELEMENT. Click on the Interface tab.


Step4. The system also generates an Interface based on the BADI name. Now double click on the interface name 'ZIF_EX_BADI_DEFN_DEMO3'.


Step5. It navigates to SE24 transaction. Now in the 'METHODS' tab, provide a method name as 'DISP_MESSAGE. Select the level and provide the description and activate the interface. At last
 click on the BACK button.

Step6. Creating a BADI Implementation. Go to TCODE - SE19. Under the CREATE Implementation Section, Select the Radio button classic BADI and provide the BADI definition name created above and click on the Create Impl. button and it will show a popup screen . Provide the Implementation name as 'ZBADI_DEF3_IMPL1' and click on the continue button.


 Step7. Provide a implementation short text. In the Types section the filter Type LAND1 appears. Provide a value to it.


 Step8. Click on the '+' button and provide a value to it as 'ID'.


Step9. For this implementation the system automatically creates a Implementing Class which implements the method 'DSIP_MESSAGE' of the interface associated with BADI definition.
Now double click on the method 'DISP_MESSAGE' to implement the method.


Step10. Provide some statement here and then click on the activate button and at last click on the back button.


Step11. Activate the implementation. Now up to this point we created a BADI implementation successfully. 


Step12. Go to TCODE-SE19 and create a second implementation. Under the CREATE Implementation Section, Select the Radio button classic BADI and provide the BADI definition
name created above and click on the Create Impl. button and it will show a popup screen.
Provide the Implementation name as 'ZBADI_DEF3_IMPL2' and click on the continue butto


Step13. Provide an implementation short text. In the Types section the filter Type LAND1 appears. Provide a value to it by clicking on the '+' button. Provide a value to it as 'HU'. At last click on the Interface tab. 

Step14. For this implementation the system automatically creates an Implementing Class which implements the method 'DSIP_MESSAGE' of the interface associated with BADI definition.
Now double click on the method 'DISP_MESSAGE' to implement the method.


Step15. Provide some statement here and then click on the activate button and at last click on the back button. 


Step16. Activate the implementation. Now up to this point we created another BADI implementation successfully. 


Step17. Calling the BADI implementation from the program. Go to TCODE - SE38 and create a report program. 


Step18. Create a reference variable referring to the Interface name associated with the BADI definition. Then call the static method GET_INSTANCE of the class CL_EXITHANDLER.
Pass the BADI definition name and it will return the object of the active implementing class to the reference variable. Activate the program and run it.


Step19. Provide LAND as 'ID'. 


Step20. The output is shown below. Implementation 1 is called with filter value 'ID'.


Step21. Provide LAND as 'HU'.


Step22. The output is shown below. Implementation 2 is called with filter value 'HU'.


Step23.  Provide LAND as 'US ' and press F8. No output is displayed as no implementation filter value is matched against US.

                              XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Share this

Related Posts