Skip to Content
Technical Articles
Author's profile photo Arpit Gupta

Webdynpro : All about doInit and doModify method

Overview

In this blog post you will have information about doInit and doModify methods of a  ABAP Webdynpro application. It will explain the key differences and similarities in both methods. As a beginner to ABAP WD, you will get an idea of both methods that are sometimes very useful in our coding cycle.

 

Difference in both methods

WDDOINIT() and WDDOMODIFY() both are hook methods.

 

WDDOINIT() is called first , WDDOMODIFY()  called second.

 

WDDOINIT() is called only once when the view loads/initialised.

WDDOMODIFY() is called every time when there is any event triggered or action happens.

 

WDDOMODIFY() is available in component controller, window and views level.

WDDOMODIFY() is not present in component controller level. It is also not available in window level. It is only available in views.

 

WDDOMODIFY() has a special importing parameter – “FIRST_TIME” that is always set as ‘X’ or abap_true  when this method is called for first time. From second time onwards, the variable will be blank.

This is a very helpful variable to set a condition or write lines of code that needs to be executed only once and can only be written inside WDDOMODIFY()  method.

 

To initialise something when WD loads, example – set default attribute values or hide/unhide buttons, text etc., use the method – WDDOINIT() or if you still want to use WDDOMODIFY() , then write code as :

if first_time eq abap_true

“my code

endif.

 

Conclusion

In this blog post, we saw how and where these methods are beneficial to use.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.