on 05-28-2009 9:53 AM
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 ?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.