Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Destroy / free BADI instance

christian_swonke
Participant
0 Kudos

Hi all,

I am using own BADI's to handle different implementations based on several filter criteria.

The BADI's are used inside RFC function modules.

The external sytem is calling the RFC's within a session and is keeping the session open as long as necessary. This means it could be that within one session 2 times the same RFC is called.

Now I want to optimize the memory usage of this open session and furthermore avoid that first RFC call is maybe influencing anyhow the second call. I.e. if I have class attributes at BADI implementation which were changed.

Is ther something like a free object or any way to destroy a BADI instance after using it and before leaving the RFC function?

Regards

Christian

3 REPLIES 3

FredericGirod
Active Contributor

In ABAP there is no standard way to clean memory from instance. When people will propose you Free or something else, this will only remove the link between the variable & the instance, but the instance stay in memory.

What you could do, is to use single instance class: Design Patten SingleTon

christian_swonke
Participant
0 Kudos

Hi Frederic, thanks for your answer.

I was also already thinking about using singleton pattern. But this would mean I have to avoid using BADIS at all and handle the creation via factory method/class. Right?

0 Kudos

Yep, it will be easier to use a Factory, and if you have criteria for implementation, you could use the factory to manage MultiTon (multiple singleton, based on criteria you find the right instance)