on 11-26-2009 4:56 PM
Hi to all,
i have a problem, this is my senario: I have a main window (1) in which there is a view with a data table. and a button. When i click this button a new window (2)is opened and where there is an input field and another button "save".
When i fill the field and i click on button ,i'd like to close this window2 and refresh the data table of the window1. I suppose that i have to link an outboud of the window1 to the inbound of the window2, so the views on the window2 can refresh, because the code of SELECT data from the table is in the method init of the View.
How can i do this? Someone can help me?
Thanks
HI,
If these windows are of same component then try to use the component controller for these data exchanges....
Try to code in component controller and it's attributes...
How are you opening this window ..is it a popup or external window....
Regards,
Lekha.
Edited by: Lekha on Nov 26, 2009 10:33 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes the window2 is a pop up. So you are saying that when i click in the save button, i lhave to ink this action to a component controller method which modify the context of the table, It correct? But in this case the page, and so the table in the window1, are automatically refreshed?
Thanks for your answer
hi ,
proceed like this :
1 create context nodes in ur component controller and make contributes under it
2 map the context node node in both of ur views view1 and view2 , to ur component controller
JUST DRAG AND DROP the context node from ur component controller to ur views
ie map the context
4 since u r mapping the context which is binded to ur input field with component controller , tht wud be accessible in
ur view1 of window win1, similarly map the node which is binded with ur table UI to the node in component controller
5 in ur view2 ( popup ) , subscrible to action on click of button
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( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window(
window_name = 'W_POPUP'
message_display_mode = if_wd_window=>co_msg_display_mode_selected
button_kind = if_wd_window=>co_buttons_save
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_save
).
DATA: l_api TYPE REF TO if_wd_view_controller.
l_api = wd_this->wd_get_api( ).
" Subscribe to button event
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_save
action_name = 'ON_SAVE " create method with this name in the Methods tab
action_view = l_api
is_default_button = abap_true ).
lo_window->open( ).
6 in ur ON_SAVE method , read the value entered in the input field using get_attribute method
u cn use the control wizard , press cntrl +f7 , n choose read context node/attribute and choose the attribute which is
binded to ur input filed , suppose we get the value lv_input
7 in ur view1 , get get the table's data in an internal table.
8 Bind the internal table with the Table UI.
select * from mara into table itab where matnr = lv_input .
DATA lo_nd_node TYPE REF TO if_wd_context_node.
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lo_nd_node->bind_table( itab ).
// here in first vie node NODE is binded with table UI which is also binded to node in component controller
It shud solve ur problem
rgds,
amit
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.