cancel
Showing results for 
Search instead for 
Did you mean: 

Reloading the Entire Application

Former Member
0 Kudos

I have a web-dynpro Application with only 1 View. I am doing some database modifications and displaying some data. Now my requirement is when i click a button on the view the entire web dynpro application should get reloaded.

How can i achieve that ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Manjunath,

We had a refresh button in our application in which we were loading the application again.

To achieve this perform the following steps -

1) In component controller create a wrapper method say - CALLINIT( ).

2) in this method call method WDDOINIT( ).

3) on click of Refresh button lets say the action is ONACTIONRELOADPAGE

4 ) IN this method call the component controller method CALLINIT like

wd_comp_controller->callinit( ).

I've tested this by creating my own test application.

Although calling hook methods is not advisable but it served the purpose for us and we able to reload the application with new set of data.

Regards

Manas Dua

Edited by: Manas Dua on May 29, 2009 12:01 PM

Former Member
0 Kudos

Hi Manas,

I tried calling the WDDOINIT method in another wrapper method, but i am not able to do so.

Can you please let me know, how you achieved the step 2 .......?

1) In component controller create a wrapper method say - CALLINIT( ).

2) in this method call method WDDOINIT( ).

3) on click of Refresh button lets say the action is ONACTIONRELOADPAGE

4 ) IN this method call the component controller method CALLINIT like

wd_comp_controller->callinit( ).

Regards,

Runal

former_member40425
Contributor
0 Kudos

Hi,

1) In component controller create a wrapper method say - CALLINIT( ). and write down the whole code which have writen in wddoinit( ).

2) Call CALLINIT in method WDDOINIT( ) like wd_comp_controller->callinit( ).

3) on click of Refresh button lets say the action is ONACTIONRELOADPAGE

4 ) IN this method call the component controller method CALLINIT( ) like

wd_comp_controller->callinit( ).

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

Hi Runal

A simple call of wddoinit will work.

No special provisions are reqd.

you can create a test application to test this.

method RELOAD .
  wddoinit( ).
endmethod.

former_member40425
Contributor
0 Kudos

Hi Manas,

But to refresh the application we need to call the wddoinit method of component controller.

method RELOAD .
  wddoinit( ).
endmethod.

The above code will call wddoinit method of the view.

Please correct if I am wrong.

Regards,

Rohit

Former Member
0 Kudos

Hi,

Thanks.

I have called it like this

 call method WDDOINIT.   

Former Member
0 Kudos

Can u let me know how to do ?

Former Member
0 Kudos

Hi Runal,

In the component controller, i creatd a method CALLINIT.

METHOD callinit .

wddoinit( ).

ENDMETHOD.

Now in my reload button action,

METHOD onactiondoreload .

wd_comp_controller->callinit( ).

ENDMETHOD.

Is this the way ?

Former Member
0 Kudos

Hi Manjunath,

Create a method in component controller and put this code n it.

   call method WDDOINIT.  

In the event handler method of the button put this code



DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).

  lo_componentcontroller->call_wddoinit(  
  ).      "Put the name of your method you created above instead of call_wddoinit()

Regards,

Runal

former_member40425
Contributor
0 Kudos

Your event handler would be something like this.

METHOD onactiondoreload .
DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).

  lo_componentcontroller->callinit(
  ).
ENDMETHOD.

Regards,

Rohit

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You should never call the methods of the Web Dynpro Phase Model (like WDDOINIT) directly. This is not supported and can lead to inconsistencies. You should encapsulate your logic that is within these methods into a separate method and only call that inner custom method if you want to force the same logic to run again later.

Former Member
0 Kudos

Thomas, thanks for the suggession.

I have a web-dynpro Application with only 1 View. I have a refresh button on that view. When i click on a button of a view, the webdynpro application should reload again.

Can you please sugggest me

Former Member
0 Kudos

Hi Rohit if i create a method in which init is called, and use this new mthod call in the button action, the view init is not getting triggered. This means the application is not reloaded. let me know if i am wrong

Former Member
0 Kudos

Hi Manjunath,

I debugged my own application and found that while calling component controller hook method like this

do init of view is not getting called.

In this scenario, the best way out as Thomas suggested could be to copy ur logic for fetching data in some other method and call it instead rather than calling hook methods.

Regards

Manas Dua

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Manjunath,

The easiest way to reload application with fresh data would be to call component controller hook method

WDDOINIT.

We also faced the same problem - we were filling data in comp controller init and displaying it to the user, when user updates the data at back end and refreshes the view only domodify method of view will

be called, so no updated data was fetched. So to overcome this we simply called component controller

hook method WDDOINIT from our view method handling that reload event.

Hope this helps.

Regards

Manas Dua

Former Member
0 Kudos

Manas,

can you let me know how you did this ?

Former Member
0 Kudos

hi Manas,

Are you sure you were able to call the hook methods of the component controller explicitly....?

I am aware of the fact that these hook methods are called by the run time and for that matter i quote the below lines from help.sap.com

each local controller interface has a fixed number of methods that can only be called by the runtime. The application developer cannot specify when these methods are called, but can modify the implementation. The time when these methods are called is predefined. For a description, refer to the phase model of Web Dynpro.

Regards

Runal

former_member40425
Contributor
0 Kudos

Hi,

You can use suspend and resume plugs to open application in same window.

Go through the following links.

http://help.sap.com/SAPHELP_NW04S/helpdata/EN/45/19bf8c16f25d7ae10000000a11466f/content.htm

I hope it helps.

Regards,

Rohit

former_member230839
Participant
0 Kudos

Hi Manjunath,

I have a solution but this code will open a new window may be usefull just check.

data lo_window_manager type ref to if_wd_window_manager.

data lo_api_component type ref to if_wd_component.

data lo_window type ref to if_wd_window.lo_api_component = wd_comp_controller->wd_get_api( ).

DATA: URL TYPE STRING.

CL_WD_UTILITIES=>CONSTRUCT_WD_URL(

EXPORTING

APPLICATION_NAME = component name

IMPORTING

OUT_ABSOLUTE_URL = URL ).

lo_window_manager = lo_api_component->get_window_manager( ).CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW

EXPORTING

URL = URL

MODAL = ABAP_FALSE

HAS_MENUBAR = ABAP_TRUE

IS_RESIZABLE = ABAP_TRUE

HAS_SCROLLBARS = ABAP_TRUE

HAS_STATUSBAR = ABAP_TRUE

HAS_TOOLBAR = ABAP_TRUE

HAS_LOCATION = ABAP_TRUE

RECEIVING

WINDOW = lo_window.lo_window->open( ).

Regards,

Anil kumar G

Former Member
0 Kudos

Hi Anil,

by calling the method create_external_url( ),the same application will be opened in a separate window(ofcourse with the new set of data), but guess that is not the solution Manju is looking at.

Best Regards,

Ashish Singhal.

former_member230839
Participant
0 Kudos

Hi Manjunath,

My concern is some where you are doing some calculation to disply the data in tha page in the flow of when you reload the page. that must be in some method i guess. Call that method only directly on click of some refresh button which will do the same thing.

regards,

Anil kumar G

Former Member
0 Kudos

Hi Anil,

Forget about the displaying of data. When i click on a button of a view, the current browser should get reloded again. That is the requirement

Former Member
0 Kudos

Hi,

Do you want to show the latest content in the view after the DB modifications.

Is that so.

For this, you can get the data and bind the table again with the latest set of records.

Regards,

Lekha.

Former Member
0 Kudos

showing that database contents can be done by bringing the latest context data. That can be done. But i just want to reload the entire web dynpro component in a button action. I just want to know how to reload the application on a button click.

former_member40425
Contributor
0 Kudos

Hi,

Get URL of the application using the name of application. For this you can use following code in the event handler .

** DATA DECLARATIONS
  DATA:
    l_cmp_api        TYPE REF TO if_wd_component,              " Reference for Component
    lv_url           TYPE        string.                       " Url of the application
 
* Generate the url for the component
  CALL METHOD cl_wd_utilities=>construct_wd_url
    EXPORTING
      application_name = 'ZAPP_NAME' "Application name
    IMPORTING
      out_absolute_url = lv_url.

Then call this lv_url in the event handler.

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

Hi Rohit / Anil Kumar,

If we do so, a new browser will get opened keeping the old one opened. I want the application to get reloaded in the same browser.

Edited by: Manjunath CN on May 29, 2009 11:12 AM

former_member230839
Participant
0 Kudos

Hi Manjunath,

Why do you want to reload .? other than this just call the method again where you are doing this data base modification in a refresh method .

regards,

Anil kumar G

Former Member
0 Kudos

As per the requirement i need to reload the application. The database modifications i sjust an example i gave.