cancel
Showing results for 
Search instead for 
Did you mean: 

Popup context not updating

Former Member
0 Kudos

Hi All,

I have a WD application that uses a modal, main, ui and functional component structure.

Within one of my base user components, at the bottom level, displays a table of data bound to a node. This node is within a node that is marked as an input. Onselect of a table line i fire a popup as per below.



  lo_window         = lo_window_manager->create_window(
    window_name          = 'W_AMEND_TEMPLATE' 
    message_display_mode = if_wd_window=>co_msg_display_mode_selected
    button_kind          = if_wd_window=>co_buttons_ok
    message_type         = if_wd_window=>co_msg_type_none
    default_button       = if_wd_window=>co_button_ok
    ).

Simply enough right, within the view of the window "W_AMEND_TEMPLATE" i have input fields bound to the same node elements used within the table. Therefore the values on the popup view are populated with the values from the selected line.

Problem is the values that are being overridden by the user, onclick event of an update button contained within the view doesnt retrieve the new values entered by the user.

Anyone got any ideas what im doing wrong??

Many thanks All

Edited by: David Steele on Mar 7, 2012 10:15 AM

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

So here is my setup - still cant get new values back from popup window inputs?

ZWDR_MODAL_COMP (Marked as interface)

->Has Defintion of parent node "mail"

->Defintion of child node "existing_temp"

ZWDR_MAIN_COMP (Nodes Mapped from ZWDR_MODAL_COMP via interface controller )

ZWDR_MAIN_UI (Marked as interface and input) - Mapping completed between UI and tempate comps

->New defintion of parent node "mail"

->Defintion of child node "existing_temp"

ZWDR_MAIN_TEMPLATE (Marked as interface and input)

->New defintion of parent node "mail"

->Defintion of child node "existing_temp"

Strangly there are other child nodes that do have updated values reflected when i pull them back via lead_selection - this are drop downs present in the page and popup?

Really stumped here - any help would be appreciated.

ashish_shah
Contributor
0 Kudos

Hi,

If you are using Two different components , you will need to Set Input Element property of Data accepting node to True.

Also you will have to use Reverse mapping.

Assuming Component ZWDR_MODAL_COMP has the method where u need to read data.

and ZWDR_MAIN_COMP has pop up view where you are accepting input from user.

In component ZWDR_MODAL_COMP , you need to declare node as interface and Input.

In component ZWDR_MAIN_COMP , you need to reverse map component node to this interface node.

Now if u try to access this node from ZWDR_MODAL_COMP component , it will give you updated values.

Regards,

Ashish Shah

ashish_shah
Contributor
0 Kudos

Check these links:

[http://wiki.sdn.sap.com/wiki/display/WDJava/ExternalMappingandNormalMapping]

[;

Former Member
0 Kudos

Can you use a mapped node within a popup?

Will the update work properly?

Thomas Jung - Help!!

ashish_shah
Contributor
0 Kudos

Hi David,

Contect mapping will work for pop up windows as well.

Try it once and let me know.

Regards,

Ashish Shah

Former Member
0 Kudos

  try.
      ex_node = im_context->path_get_node( im_node_path ).
      if ex_node is bound.
        ex_element = ex_node->get_element( ).
        if ex_table is requested.
          lr_node_info = ex_node->get_node_info( ).
          lr_table_descr ?= cl_abap_tabledescr=>describe_by_data( ex_table ).
          lr_line_type = lr_table_descr->get_table_line_type( ).
          if lr_node_info->is_multiple( ) = abap_true and
             lr_line_type->get_relative_name( ) is not initial.
            ex_node->get_static_attributes_table( importing table = ex_table ).
          endif.
        endif.
        lr_type_descr = cl_abap_typedescr=>describe_by_data( ex_data ).
        if ex_element is bound and
           lr_type_descr->get_relative_name( ) is not initial.
          ex_element->get_static_attributes( importing static_attributes = ex_data ).
        endif.
      endif.
    catch cx_root into lr_cx_root.
      zcx_crm_exception=>factory( im_exception = lr_cx_root ).
  endtry.

Passing context and lv_nodepath

Former Member
0 Kudos

I have reoved the supply function which makes no change.

If a node->subnode is definied in the component controller and then reused across multiple views i.e

my scenario of having a default vie wwith table and a popup view (in another window) then would have thought changes made via any type of element would be reflected in the nodes contents.

Is this not right ????

Thanks

former_member199125
Active Contributor
0 Kudos

Yes right,

whatever the node changes that will reflect to all controller, if you maintain context mapping.

please post ur get_lead_selection code...

Regards

Srinivas

ashish_shah
Contributor
0 Kudos

Hi David,

Assuming you have only two views inside one component ,Just follow these three simple steps:

1) Define a node in Component Controller with the attributes that you want to show in Pop up window

2) Map this Component context node with your pop up view context node

3) Map the same component controller node with your default view's context node.

Now write the code to retrieve the node data in table form, you can use below code if you wish to.


DATA lo_nd_<node name> TYPE REF TO if_wd_context_node. " Replace <node name> with name of your node

 DATA lt_<node name> TYPE wd_this->elements_<node name> . " Replace <node name> with name of your node

* navigate from <CONTEXT>  to <<NODE NAME> >  via lead selection
  lo_nd_<node name> = wd_context->get_child_node( name = wd_this->wdctx_<node name> ). " Replace <node name> with name of your node

  lo_nd_<node name>->get_static_attributes_table( IMPORTING table = lt_<node name> ).  " Replace <node name> with name of your node

Regards,

Ashish Shah

Edited by: ashish shah on Mar 7, 2012 4:18 PM

Former Member
0 Kudos

OK - so now if i invalidate the node, and then perfomr a get_lead_selection the node is empty???

The node does have an assocaited supply_funtion - could this be the problem?


  clear lv_node_path.
  concatenate wd_this->wdctx_mass_mail wd_this->wdctx_temp_existing into lv_node_path
  separated by '.'.
  wd_assist->get_lead_selection( exporting im_node_path = lv_node_path
                                           im_context = wd_context
                                 importing ex_node = lr_nd_templates ).

  lr_nd_templates->invalidate( ).
  clear lv_node_path.
  concatenate wd_this->wdctx_mass_mail wd_this->wdctx_temp_existing into lv_node_path
  separated by '.'.
  wd_assist->get_lead_selection( exporting im_node_path = lv_node_path
                                           im_context = wd_context
                                 importing ex_node = lr_nd_templates
                                           ex_data = ls_template ).

Former Member
0 Kudos

Hi,

To harshith_reddy

Yes the update button is contained within the view of the popup and the code within is



  clear lv_node_path.
  concatenate wd_this->wdctx_mass_mail wd_this->wdctx_temp_existing into lv_node_path
  separated by '.'.
  wd_assist->get_lead_selection( exporting im_node_path = lv_node_path
                                           im_context = wd_context
                                 importing ex_node = lr_nd_templates
                                           ex_data = ls_template ).

This method is just a fancy way of pulling back whatever is requested, i.e structure, table and/or node via lead_selection.

To sanasrinivas/bsivasap

Problem is that ls_template contains old values not the newly entered values by the user??

Where should i being invalidating teh node to ensure values returned via get_lead_seelction are the new values?

Former Member
0 Kudos

hi,

in your button action:

after you insert the new record --> then invalidate the node --> then bind the table to node again.

Regards,

Siva

ashish_shah
Contributor
0 Kudos

Hi David,

Please post the code inside method wd_assist->get_lead_selection().

Regards,

Ashish Shah

Former Member
0 Kudos

Hi David,

so when you click on button the existing record is getting updated with the new record.

after insert code-->you have to invalidate your node --> then again bind the table to node.

Regards,

Siva

former_member199125
Active Contributor
0 Kudos

Hi David,

If you update a existing record then same record you can check in table,

But I think you are inserting a new record using pop up window.

So in insert button action, after your insert code, refresh your node..

Regards

Srinivas

Former Member
0 Kudos

Hi,

Have you used the update button within the view which is shown as popup?

and also whats the code you have written inside the button event?