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: 

Multiple Implementations of Badi

Former Member
0 Kudos

Hi All,

I understood the concept of BADI -----means used to enhance the standard object or functionality in system.

I have created one Badi in the system and following are the steps.

1. Create Enhancement spot in SE18.

2. Created BADI definition in the Enhancement spot.

3. Assigned Interface to the created BADI

4. Then i have created BADI implementation and where it ask for the Enhancement implementation (Enhancement Implementation also created in same step)

5. Created Badi Implementation class and also done the implementation of Interface methods.

6. Done the activation of BADI and Enhancement spot.

Calling the same Badi in the zprogram.....

Data bd type ref to zBADI_definition.

get badi bd.

call badi bd->method importing parms.

I executed the program and it worked fine.

Now again opened the enhancement spot in SE18.

I have second implementation of same Existing BADI in the new Enhancement Implementation.

Now how to call the new implementation in the same program?

Request you to please help here.

Thanks,

Baljit

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Baljit,

If you need to call a specific implementation, use the concept of FILTER. You can define a filter value for every implementation that you create and during call badi, use the filter value. SAP will call only that implementation that matches the filter value you pass.

Additionally the understanding is we cannot control the sequence of implementation call. This is not true. By creating a screen enhancement for badi_sorter along with using filters, we can control the sequence.

Enhancement impl and Badi impls are different from one another. Every explicit enhancement is assigned to a spot. To implement these explicit enhancements, we need to create new implementations. The implementations that we create will either replace SAP's implementation or will get executed along with SAP's implementation.

Thanks,

Vikram.M

12 REPLIES 12

Sudhakargadde
Participant
0 Kudos

hello Baljit,

the implementations supports multiple implementation aren't if supports it triggers both the implementation are but you can't control the flow of execution of implementations.

Thank you.

Sudhakar

gurunathkumar_dadamu
Active Contributor
0 Kudos

Hi Baljit,

open your Badi and check the multiple use(marked). to implement another implementation to the same badi from the same screen---> implementation--->create-->give the implementation name-->write your logic in any of the methods where you want to develop.

let me know if any issues.<Reward request removed by moderator>

Regards,

Gurunath Kumar D

Message was edited by: Vinod Kumar

Former Member
0 Kudos

Thanks all for the reply.

My Question was-- how to call a particular Implementation of BADI ?--(Because Badi has multiple implementations).

So here myself found that, on the basis of Filters, we can call any one of the implementation.

if i am wrong here, kindly correct me.

one more question---what is the use of Enhancement Implementations?

Because we have multiple Enhancement implementations in the Enhancement Spot.

Further Enhancement Implementations has no. of Badi Implementations.

what is the use of Enhancement Implementations?

Thanks in advance for informative reply.

Baljit

0 Kudos

Hi Baljit,

For multiple implementations there is no sequence control because at the time of BADI definition it does not know which implementation will be active. Badi with filter is different.

In Enhancement implantation where ever you want to insert the code in standard code like end of the FM,end of the routines..etc.here sap will provide the some pre defined placeses where we can insert the our logics.

for more information please refer the following link http://scn.sap.com/thread/400329.

Regards,

Gurunath Kumar

Former Member
0 Kudos

1. BADI is SAP giving us hook.....so all the active implementations are called, that matches filter of course.

2. If you want to call specific implementation....can you try calling the clas method directly, in you r Z program.

Former Member
0 Kudos

Baljit,

If you need to call a specific implementation, use the concept of FILTER. You can define a filter value for every implementation that you create and during call badi, use the filter value. SAP will call only that implementation that matches the filter value you pass.

Additionally the understanding is we cannot control the sequence of implementation call. This is not true. By creating a screen enhancement for badi_sorter along with using filters, we can control the sequence.

Enhancement impl and Badi impls are different from one another. Every explicit enhancement is assigned to a spot. To implement these explicit enhancements, we need to create new implementations. The implementations that we create will either replace SAP's implementation or will get executed along with SAP's implementation.

Thanks,

Vikram.M

0 Kudos

Thanks very much Vikram for the wonderful information regarding call of specific implementation and sequence call through badi_sort.

As you mentioned that enhancement and badi implementations are different from one another.

if you see the above screen shot where i am calling Badi "ZBADI_SEGMENTATION".

For this badi, i have two BADI implementations each in different Enhancement implementation.

So in the above code, i am calling the badi without any reference to enhancement implementation and it working fine and picking result based on filter.

Actually my point here is the use of Enhancement implementations.

I don't understand the use of Enhancement implementations or where does it play role?

Please give me some idea behind Enhancement Implementations.

Thanks again,

Baljit

0 Kudos

Baljit,

Try to see it like this.

In case of Badi's (classical), the normal procedure is to create multiple implementations (when multiple is allowed) so that each of this implementation is called. These implementations are referred to as badi implementations.

In the enhancement framework provided by SAP, every explicit enhancement is a part of a SPOT. This is nothing but a container(imagine something like a TR). Now in order to implement any of these enhancements (explicit) that is provided by SAP, the abaper needs to use an implementation. These are the enhancement implementations.

So to answer your question, kernel badi are explicit enhancement options provided by SAP. To implement a BADI we need badi implementations. Since each of these badi implementations are an explicit enhancement, we need ENHANCEMENT IMPLEMENTATIONS to implement the same.

hope this makes it clear.

Thanks,

Vikram.M

0 Kudos

Hi,

Enhancement implementations are just container too.

As Vikram stated enhancement spots contain enh.sections and enh.points.(SAP code provides these)

And customers (we) implement this options with 'enh. implementation elements' (As ENHANCEMENT 1 .. portion of your code). Finally 'enh.implementations' are just containers for 'enh. implementation elements'.

      Enh. spot                         ------>               Enh. Implementation

     /               \                                                         |

   /                   \                                                       |

Enh. section     Enh.point        ------>        Enh. implementation element

Former Member
0 Kudos

Hi Vikram/Tunahan,

So it means, Enhancement Implementation is just a container.

I have created one Badi Impelementation "BADI_IMPL01" in "Enhance_Implementation01".

Second Badi Implementation "BADI_IMPL02" in "Enhancement_Iplementation02"

Both Badi Implementations are of same Badi Definition but in different Enhancement implementations.

But i could create both Badi implementations in the same Enhancement Implementation,so what is the use of implementing in the different Enhancement Implementations.

it could be a silly question,  but could not understand the role of Enhancement Implementations.

Please if possible give any example.

Thanks,

Bajit

0 Kudos

Baljit,

In this specific case there is no need to create 2 different EIs. See EIs in a different picture and you will be able to understand why:

Lets say your client does not want to provide key to MV45AFZZ. If every developer is going to use the same EI, it will always be edited by someone or the other. On the other hand if every developer works on his own EI (I am not saying this is a good idea), no 2 developers have to worry about transporting his/her own code as each EI is an object of its own.

EIs are nothing but an object that holds the actual enhancement element (enhancement ..... end enhancemenent)

0 Kudos

can we deactivate the existing implementations and make our implementation run ?

since we want our implementation to trigger .

hence we can go to se19 ->utilities->implementations -> deactivate .

and in this way also we can control the flow of implementations ?

can you please elaborate badi_sorter ?