cancel
Showing results for 
Search instead for 
Did you mean: 

WDDOINIT - Initialization methos is NOT triggering!!

former_member202077
Participant
0 Kudos

Hello

I have view_1 and view_2.

View_1 has a input field for entering the Material number. Then, i will pull (am pulling from database in WDDOINIT method of View_2) all the details/data for this material. And i will display all these details in View_2.

View_2 has also some other input enabled fields, say, my_input_field. It also has a button for navigating back to View_1, button caption is 'Go Back'

Now, user started the application, entered the matnr_12345678 in View_1 and clicked 'Run' on View_1, then user get into the View_2 with the matnr details and entered a value of 'TEST' in my_input_field on View_2.

But, decided go back once to enter a DIFFERENT material # (same execution) to View_1 (user perspective, its a new execuution), so, clicked 'Go Back' button on View_2 and came to View_1 again, enetered a new matnr # pressed 'Run' on View_1, reached View_2, but still the previously entered value TEST still persisting / lying there in my_input_field of VIew_2!!

Actually, i am expecting / requirement is nothing (previously enetered data, example TEST) shuld not be there in View_2, it should display new material # details (not, matnr_12345678)

When, i debug, i noticed that, the WDDOINIT is triggering VERY first time clicking the RUN button on View_1 ONLY. But not triggering this initialization method of View_2 (where am pulling the matnr details from data base) for 2nd time RUN click!!

Pls. let me know either how can wipe off the previously enetred data (or) the best & safe idea is pls. let me know How can able to trigger the WDDONITI method for even 2nd time RUN clcik as well?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

In fact this is all about plugs. I guess that, if you are able to go from view1 to view2, you have an outbound plug in view1 and an inbound plug in view2, with a call to the outbound plug when you want to display view2.

The link between outbound and inbound is made at the level of the window.

Once you know which inbound plug is called, go to the inbound plug tab when you edit your view, and double click on the inbound plug. This will open the method where you can put your code.

Hope this will help

former_member202077
Participant
0 Kudos

Thank you all.

For a better and safe approach, among the below 2 options, which option ii should consider?

1) Wrting my code in WDDOMODIFY method?

2) When inbound plug triggers on View_2 event?

Which is a good best preactice to my logic?

Thank you

ChandraMahajan
Active Contributor
0 Kudos

Hi,

It is always better to avoid writing code in WDDOMODIFY method as the behaviour at runtime cannot be predictable.

Use inboud plug approach.

Thanks,

Chandra

former_member202077
Participant
0 Kudos

Thank you

Answers (4)

Answers (4)

GirieshM
Active Contributor
0 Kudos

Hi ,

I understood from your requirement that , after moving from 2nd page to 1st page and after giving new matnr and going to the 2nd screen, the screen should display the material details and free the my_input_field as blank which is used to enter the comments for that specific new material.

If so , then there will be a event known as "Handlein" in the view2 screen when you create a navigation. Copy the code of wdoinit of the view2 and paste it in the handlein event.

The handle in event is used to trigger when there is a change in navigation.

Hope it will satisfy your requirement.

With Regards,

Giriesh Chakaravarthy M

ChandraMahajan
Active Contributor
0 Kudos

Hi,

write the code in the event of your back button to clear the values of 2nd view. also use proper event methods to write the code.

WDDOINIT is called automatically when a controller is initialized for the first time. refer http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/c87f413e70010de10000000a1550b0/frameset.htm

Thanks,

Chandra

Former Member
0 Kudos

WDDOINIT is called only on initialization of the view. To capture any other changes place your code in WDDOMODIFY and check for first_time = abap_false.

Former Member
0 Kudos

Hi ABAP_SAP_ABAP ,

The WDINIT will call once when the imitialization of view is done.

It will not call everytime u navigate to the view.

You can achieve your requirement by Creating a event/Method(in Component controller or in forst view as per your node) and call that event/method when your navigate button is clicked on First Screen.

Nawal Kishor Mittal