Classic Badi Sorting Technique


 Scenario: Many a times we need to call the Multiple Badi implementations, in a sequential manner as per the sort technique because by default the multiple Badi implementations are called randomly by the run time environment. To achieve this SAP provides sort technique.

Different Sorting Types:

1.No Sort

2. Standard Sort

3. Special Sort

In this post we are going to discuss about the standard sort technique. To achieve this, while creating the BADI definition, we will specify a sorting type and during each BADI implementation we have to specify a BADI LAYER number which is a numeric one which in turn determines the BADI implementation calling sequence.

Step1. Go to Tcode- SE18 to create a BADI Definition                                                                                                                                                                                                                                       

  Step2. Provide a BADI definition name and navigate along the highlighted path to create a Classic BADI.

  Step3. Provide the description and check the Multiple Use Badi type is selected. After that click on the interface tab.
 

 Step4. The Interface name is automatically provided by the system. Now double click on the Interface name to provide a method.

 Step5. Provide a method name as ‘TEST’, select LEVEL as Instance Method. Activate it and go back.

 Step6. Navigate along the highlighted path to provide a sort type.

 Step7. From the options, select Standard sort type and click on the continue button. When Standard sort is selected, in the later step, in BADI implementation we can find a new input filed called BADI LAYER where we can provide the layer number.

Step8. Select a request and click on continue button.

 Step9. Save the BADI definition and go back to create the BADI implementation.

 Step10. Go to Tcode- SE19 to create the BADI implementation.

 Step11. In the Create Implementation section, provide the BADI definition name and click on ‘Create Impl.’ button

Step12. Provide a implementation name and then click on continue button.

 Step13. Provide the description, Layer Value as ‘1’ and then click on the Interface tab.

Step14. Double click on the method name to implement it.

 Step15. Click on YES button to continue.

Step 16. Provide some text. Activate the method and go BACK.

Step17. Activate the implementation and go BACK.

 

Step18. In the Create Implementation section, provide the BADI definition name and click on ‘Create Impl.’ button.

 Step19. Provide a implementation name and then click on continue button.

 Step20. Provide the description, Layer Value as ‘2’ and then click on the Interface tab.

Step21. Double click on the method name to implement it.

 Step22. Click on YES button to continue.

Step23. Save in local object.

 

Step24. Provide some text. Activate the method and go BACK.

 Step25. Activate the implementation and go BACK.

 Step26. In the Create Implementation section, provide the BADI definition name and click on ‘Create Impl.’ button.

 Step27. Provide a implementation name and then click on continue button.

Step28. Provide the description, Layer Value as ‘3’ and then click on the Interface tab.

 Step29. Double click on the method name to implement it.

 Step30. Click on YES button to continue.

 Step31. Save in local object.

 Step32. Provide some text. Activate the method and go BACK.

Step33. Activate the implementation and go BACK.

 Step34. Go to Tcode- SE38 to create a report to call the BADI Implementations.

 Step35. Create a report and provide the below code. Activate and execute it.

 Step36. The implementations are called as per the BADI layer value provided in each badi implementation. Now lets edit/change each badi implementation and provide a different layer vale and test it again.

 Step37. Go to Tcode- SE19 .

Step38. Go to the Edit Implementation part, select appropriate radio button and provide our first BADI Implementation name and click on change button.

 Step39. All are in display mode as the badi implementation is active. Click on the De avtivate button.

 Step40. The previous badi layer value is 1.

 Step41. Change the Layer vale to 3, activate the implementation and go back.

 

 Step42. Provide the 2nd badi implementation name and click on change button.

Step43. Click on the De activate button to make it editable.

 Step44. Change the Layer value to 1 and activate the implementation.

Step45. Provide the 3rd badi implementation name and click on change button.

 Step46. Click on the De activate button to make it editable.

 Step47. Change the Layer value to 2 and activate the implementation.

 Step48. Again execute the same above created report .

 Step49. The output is as follows. The implementations are called according to the layer value .


 

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