10-23-2015 11:30 AM
Hi GURUs,
Can you please tell me a scenario where multiple active implementation of a BADI is absolutely necessary? For example, we have a BADI ME_PURCHDOC_POSTED which is multiple-use. But why do we need this as multi-use, is there any functionality that we would have missed if it was a single implementation BADI?
Thanks,
Sariful
10-23-2015 11:38 AM
Off course we will miss. The advantage of multiple implementation is that you can deactivate any implementation you want without affecting others and it is very easy. If you go for a single implementation in order to deactivate your change you have make a change in your code which includes the cost of testing along with it and usually take more time.
Also for filter dependent BADIs you can call different implementation based of different condition. This is another advantage.
R
10-23-2015 11:38 AM
Off course we will miss. The advantage of multiple implementation is that you can deactivate any implementation you want without affecting others and it is very easy. If you go for a single implementation in order to deactivate your change you have make a change in your code which includes the cost of testing along with it and usually take more time.
Also for filter dependent BADIs you can call different implementation based of different condition. This is another advantage.
R
10-23-2015 11:43 AM
Hi Rudra,
As far as I know we can have multiple implementation for single implementation BADI as well, the only difference is only one of those implementation should be active at a time. So we can easily deactivate an implementation and activate another in single implementation BADI as well.
10-23-2015 11:59 AM
Hi Sarif,
Yes, you are right, but probably you did not get my comment. For "Multiple use" you have the flexibility to switch off/on any implementation you want and when you need, but for single use as you have stated you just cannot do that.
So e.g.
Implementation A
Implementation B
Implementation C
For "Multiple use" you have the option to trigger either A, B, C or A,B or B,C, or A,C or A,B,C,
so 3! = 6 combination possible.
For "Single use"
Only one you have the option to run Either A or B or C. So 3 combination possible.
For more implementation the difference will increase. And as per me I would be happy with more combination here rather than making changes in code to have more combinations which I have explained already.
But there are some restriction SAP has put in case of some BADIs to purposefully make them "Single use" to put the onus on the customer.
Sometimes you might have noticed that there are implementation created by SAP . Since the Normal BADIs are owned by SAP, they want to control how we use SAPs code. Along with SAP's code ( "Multile Use" ) or Ignore SAP's code to apply your own code ( "Single use " ). It is something like switch.
It is all about option. Either way it will work but as I explained there are other aspects behind it.
Hope it makes sense now.
R
10-23-2015 12:09 PM
10-23-2015 1:29 PM
In addition.
Do you put all your code into a single method or subroutine? Of course not. If you have two separate pieces of functionality, not particularly connected to each other, you put them into separate methods or subroutines. In the same way you put logically independent functionality using the same BADI into separate BADI implementations.
Secondly, multiple use BADIs often have provision for filtering. This means that one implementation can apply to one specific entity, and another to a different one without having to code an "IF entity1 ... ELSEIF entity2...". It also allows entity3 to use entity1's coding without additional programming.