Application Development and Automation Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
10,408

Hi Developers ,

Consider a scenario in which you are going to create BADI definition as well for a customer exit.

Here are the steps:

a ) Find out the correct customer exit for your requirement from the functional team.


     

b ) Create enhancement in CMOD and activate the components. (See below screens)

    

      

        

c)   Go to SE18 and create a BADI definition.

      

d)  Create an instance method (public) for the BADI with parameters (if needed).

        

      

         

e)  Create implementation for the BSDI.

               

                    

                    

f)     Here, see the method (public) created in definition is already assigned to your implementation (EXIT_SAPLFMR4_002).

              

               

g )  Apply the validation in the public method and business logic in private method. Call the private method in the public method after validation.

         

              

                


Now, next step is how to call the BADI from the customer exit.

                         

                       

a)  Go to your customer exit program.

                      

                    

b)  Create an instance of your BADI interface and call the public method (e.g. EXIT_SAPLFMR4_002).

      

                    

                      

c) The BADI (ZBADI_ZXFMCU08) is multiple uses BADI. In future if there requirements for the same customer exit, create a new implementation and a private method to apply logic in the BADI.


Hope this blog will prove helpful ,Pls feel free to reach out for anything ! :wink:

Thanks and Regards,

Praveen Srivastava

17 Comments
vneecious
Product and Topic Expert
Product and Topic Expert
0 Likes

niiiice! :grin:

Sougata
Active Contributor
0 Likes

Praveen,

I think a better approach would be to create a Kernel BAdI (New BAdI) instead as they are much much faster than the Classic BAdIs. You can then have multiple implementations on your custom BAdI Definition that you have defined in your Enhancement Spot if required.

You would need to call it like GET BADI followed by CALL BADI statements instead of calling cl_exithandler=>get_instance. You don't need to keep the BAdI instance in your calling program if you mark it as "Reusing Instantiation" in the instance creation mode of your enhancement spot.

This same technique can also be used to convert the Classic BAdIs into the new Kernel BAdIs/Enhancement Spots to be able to improve performance especially on the complicated dialog transactions etc.

Cheers,

Sougata.

Former Member
0 Likes

Great post Praveen.  It's nice to see some originality in a blog post and not just a summary of something already documented by SAP.  This adds the multiple implementation functionality to the classic user exits, I never thought about doing that.  Though I agree with Sougata's suggestion to use New BAdIs instead of Classic BAdIs.

Former Member
0 Likes

Yes sougata ,

I do agree with your suggestion of implement kernel BAdis instead of classical BAdis,but can u explain me one point while calling BAdi,

A classic BAdI can be called only once and the call positions are

registered centrally.

With new BAdIs, multiple calls are possible and the call positions are

not registered centrally.

For the above reasons, an automatic call migration is not possible.

In that case how it will work ?


Regards,

Praveen Srivastava

former_member182465
Active Participant
0 Likes

Hi Praveen,

Nice one. But this solution is already provided in 2007 i guess.

Rashid_Javed
Contributor
0 Likes

Interesting idea Praveen!

I like this blog because it opens up so many possibilities.

And it also makes the code cleaner and managable in customer exits.

Sougata
Active Contributor
0 Likes

Praveen, I'm not sure I understand your question.

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Sougata,

Honestly i have never created a custom BAdI; but i have used "Strategy" design pattern to achieve something similar.

But your suggestion to create custom Kernel BAdIs sounds appealing to me. Next time i have such a requirement that's the first thing i'm gonna do :smile:

BR,

Suhas

PS - Can we have your experience with custom Kernel BAdIs documented as a blog/document in SCN? :oops:

Sougata
Active Contributor
0 Likes

Yes I will try and blog it when I find time. I've done this recently in my current project.

aditya_bakshi
Participant
0 Likes

Great Write.

nikhila_ms
Explorer
0 Likes

Praveen Its really very useful blog on classic BADIs. :smile:

former_member188282
Active Participant
0 Likes

Good one... Very useful..next time i will try this one for my new developments.

Thanks for sharing. :smile:

Former Member
0 Likes

Thanks Rajesh for Acknowledgement :smile:

Former Member
0 Likes

Good articel. Very informative for a newbie like me :smile: .

Sougata
Active Contributor
Former Member
0 Likes

Nice informative :smile:

Former Member
0 Likes

Thanks shamala :smile: