cancel
Showing results for 
Search instead for 
Did you mean: 

How to simulate button click in the WdDoInit

tony_morellet
Participant
0 Kudos
151

Hi Expert,

I would like to simulate the "buttton click" in the wdDoInit ?

I have this action :

public void onActionRetour(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionRetour(ServerEvent)

wdThis

.wdGetWDCompInterfaceWinInterfaceViewController()

.wdFirePlugTo_Menu(

wdContext.currentS9521Element().getZnigend(),

1);

//@@end

}

When I excute it by clicking on the button, it's Ok, but if I want execute it into the wddoInit method, I have an error : "com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Instance of interface view controller WDCompInterfaceWinInterfaceView does not exist. "

Could you help me ?

best regards

Tony

Edited by: Tony MORELLET on Jan 23, 2009 11:27 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

create a method and write the code from your action in that method:

Now, you can call this method from action as well as wdDoInit().

Regards,

Murtuza

Answers (5)

Answers (5)

tony_morellet
Participant
0 Kudos

Thanks all,

I have solved my problem by another way.

sanyev
Active Participant
0 Kudos

Hi Tony,

Webdynpro follows a phased model. Execution happen in phases. Controllers are initialized first then windows and then views. In your case, in your controller initialization code, you are trying to access your window to fire the plug. When the controller is being initialized your window is not yet loaded. Hence you get the error. You cannot execute anything related to the window or view in your controller wdDoInit code.

You can learn more about the phase model [here in section 8|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50b0f2aa-20d0-2a10-1685-d163d88a3e09].

Regards,

Sanyev

Former Member
0 Kudos

hi,

The wdDoInit method is a Hook method whose source code is executed when the view controller is initialized.

then the view is loaded.So how is it possible to perform button click like action in doinit().

button click action invoked when the button is clicked.

the button is embeded within the view

view is controlled by the view controller.

if u want to check the button click ,then it has to be done after the view controller is loaded and not while its being loaded.

Regards

Jayapriya

tony_morellet
Participant
0 Kudos

Hi,

I have created a method that calls from the WdDoInit method.

public void Bind_Menu( )

{

//@@begin Bind_Menu()

wdThis

.wdGetWDCompInterfaceWinInterfaceViewController()

.wdFirePlugTo_Menu(

wdContext.currentS9521Element().getZnigend(),

1);

//@@end

}

I have the same message :

" com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Instance of interface view controller WDCompInterfaceWinInterfaceView does not exist. "

Former Member
0 Kudos

Hi Morellet,

Your code seems like you are navigating to another view by clicking on button as you used fire plug out method , hence it works fine .

But i dont know why you are trying to navigate to another view when loading a current view , the error may be bcoz of that , since the view before getting initialized you are trying to navigate to another view its showing error like the current view does not exit. I think you cant do so.!!!

Regards,

Sam Charles J

Former Member
0 Kudos

Hi Tony,

Better approach is create one Method and call that method in WdDoInit().

Regards,

Sunaina Reddy T