Classic BADI with Multiple Use (Multiple Implementation) without Filter


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

Step1. Go to TCODE- SE18.

Step2. Provide the BADI name 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 . Click on the Interface tab.

Step4. The system also generate a Interface based on the BADI name.Now double click on the interface name ‘ZIF_EX_BADI_DEFN_DEMO2’.

Step5. It navigates to SE24 transaction. Now in the ‘METHODS’ tab, provide a method name as ‘SHOW_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 ‘ll show a popup screen . Provide the Implementation name as ‘ZBADI_DEF2_IMPL1’ and click on the continue button.

Step7.  Provide a implementation short text and click on the Interface Tab.

Step8. For this implementation the system automatically creates a Implementing Class which implements the method ‘SHOW_MESSAGE’ of the interface associated with BADI definition.

Now double click on the method ‘SHOW_MESSAGE’ to implement the method.

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

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

Step11. 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 ‘ll show a popup screen . Provide the Implementation name as ‘ZBADI_DEF2_IMPL2’ and click on the continue button.

Step12. Provide a implementation short text and click on the Interface Tab.

Step13. For this implementation the system automatically creates a Implementing Class which implements the method ‘SHOW_MESSAGE’ of the interface associated with BADI definition.

Now double click on the method ‘SHOW_MESSAGE’ to implement the method.

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

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


Step16. Calling the BADI implementation form the program . Go to TCODE – SE38 and create a report program.

Step17. 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 ll return the object of the active  implementing class to the reference variable. Activate the program and run it.

Step18. The output is shown as below. Here as the BADI is a multiple use badi all the active implementations are called.


Information: In case of multiple use BADI, what is the sequence in which implementations are called?

Ans: Go to the BADI definition and select multiple use and press F1 button for help. It shows that the run time sequence of active implementations are unpredictable. That means there is no particular sequence how the active implementations are called.


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s