Skip to Content
avatar image
Former Member

binding multiple selected rows to table context

Hi friends,

Goodday. My requirement is in my first view i have a table with 10 fields and a button add. On clicking add button it shows a popup . In the popup a table with the same 10 fields will be displayed with datas. User selects multiple records and clicks on ok button in the popup and the records selected by the user alone goes to parent window (view1-table) .

Now I'm able to make user to select multiple rows. and in view2(popup view) in onactionok method i coded as below.

data: Node_Table_Popup type ref to if_wd_context_node,
        Elem_table_popup type ref to if _wd_context_element,
        Stru_Table_popup type if_vieew_popup=>Element_table_popup,
        lt_element type WDR_CONTEXT_ELEMENT_SET.

*navigate from <context> to <Table_popup> via lead selection
Node_table_popup = wd_context->get_childnode( Name = If_view_popup=>wdctx_table_popup ).

 lt_element = Node_table_popup->get_selected_elements(  ).

by coding as above i got the multiple selected rows in lt_elements. now friends can you tell me how to loop lt_element and bind this lt_elements into table_view1 context i.e first view table. i don know as lt_element is of type wdr_contex_element_set which is table type. Please do reply me.

Thanks,

Sudha.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Sep 30, 2008 at 04:18 AM

    Hi Sudha,

    Please find the desired code snippet as shown below:

    METHOD onactioncopy_selected_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             ls_node1 TYPE ig_componentcontroller=>element_node1,
             lt_node1 TYPE ig_componentcontroller=>elements_node1,
             lt_node2 TYPE ig_componentcontroller=>elements_node2,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set.
    
    
      wd_node = wd_context->get_child_node( name = 'NODE1' ).
    
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
    
      wd_node = wd_context->get_child_node( name = 'NODE2' ).
    
      LOOP AT lt_temp INTO wa_temp.
        CALL METHOD wa_temp->get_static_attributes
          IMPORTING
            static_attributes = ls_node1.
        APPEND ls_node1 TO lt_node1.
        CLEAR ls_node1.
      ENDLOOP.
    
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.

    You can also go through this [example|http://saptechnical.com/Tutorials/WebDynproABAP/Modalbox/page1.htm] in which the user enters a customer number in the main view & presses on a pushbutton. A popup is then displayed showing the list of all sales orders related to the customer in a table UI element. The user can then select a table row in the popup & click on a button to navigate back to the main view & display it in there. Hope that this resolves your problem.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 30, 2008 at 09:48 AM

    Hi Sudha,

    Is your requirement fulfilled? If yes then please do the needful & close the thread.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 30, 2008 at 11:03 AM

    Hi Uday,

    Sorry for late reply. Ofcourse your solution is fantastic and my requirement is fulfilled. and one more doubt is when the user selects multiple records from popup window and it gets filled in the parent window and if the user again clicks the add button the popup window comes and if user select further two records then these two records should be added to the parent window records without replacing the old records in the parent window table.

    can u explain me regarding this.

    Thanks Uday

    Regards,

    Sudha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 30, 2008 at 12:32 PM

    Hi Uday and Haresh,

    Thanks for the solutions. I'm getting the correct output. I close this thread by awarding points for both of u.

    Thanks friends,

    Sudha

    Edited by: sudha on Sep 30, 2008 2:43 PM

    Add comment
    10|10000 characters needed characters exceeded