cancel
Showing results for 
Search instead for 
Did you mean: 

Better performance, WD_BADI_DOMODIFYVIEW or WD Enhancement?

Former Member
0 Kudos

Hi experts,

I have the next question, I need to enhance method WDMODIFYVIEW in a view of a standard WD Component with some code.

For a better performance, which is the best solution, enhance the method with a pre/post/overwritten method or implement Badi WD_BADI_DOMODIFYVIEW for that component and view?

I think that it should be implement Badi WD_BADI_DOMODIFYVIEW, but I don't have any solid reason.

Can anybody argue an explanation of which solution is better?

Kind regards,

Pablo.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

For sure you should not use the "overwrite" unless you want to completely alter the behavior. Whether to use Pre-, Post-, or a specific BAdI depends on what you are trying to do. If you want to influence the output of a method (appearance of a view in case of WDDoModify), then you do a post- method. If you want to influence the input to the WDDoModify, then you use the pre- method. As for the BAdI, it depends where it is actually being called in the code.

Former Member
0 Kudos

Thanks for your reply.

BAdi is called after standard method WDDOMIDIFYVIEW. For my requirements a post-exit method and the BAdi implementation are correct solutions, the doubt is which one has a better performance.

Former Member
0 Kudos

Just took a quick look at the BAdI. I don't have an prior experience with it. If I understand correctly, it seems that this BAdI applies to all web dynpro views (which is a little strange). If that's the case, I would definitely go with the post- method. The reason is that looking at the big picture, you will eventually have a huge IF statement to check which view you are modifying in the BAdI. Keep in mind that this IF statement will be irrelevant for 99% of your views that you don't want to enhance so you are impacting all views just to enhance a few. On the other hand, in the post- method, you already know the view so you avoid this whole IF statement and therefore improving the performance a little bit.

Former Member
0 Kudos

To avoid that huge IF the BAdi has two filters, WD Component (COMPONENT_NAME) and the View (VIEW_NAME). So there's no need of checking inside the code of the BAdi waht view it's calling the BAdi.

Former Member
0 Kudos

You are absolutely right; the filters will solve that problem. Another challenge, what if you needed to access view context? The post- method will have direct access to those. I'm sure you can do so in the BAdI, but it will be longer de-tour (probably creating an interface method or something).

Former Member
0 Kudos

Method called at the BAdi has these parameters:

FIRST_TIME

VIEW

WD_CONTEXT

So there's direct access to view's context.

My requirements don't require any complex logic that's why I only want to know the best option in performance terms.

Former Member
0 Kudos

Again, you are definitely right. In this case, I would implement both and compare performance. I suspect there will be a significant difference. In either case, an enhancement object will be instantiated.

former_member199125
Active Contributor
0 Kudos

In that case I would go for post exit which is preferred by sap instead of separate enhancement implementations.

Regards

Srinivas

Former Member
0 Kudos

Is there any documentation on why it is "preferred by sap"? I think that would be what Pablo is looking for.