cancel
Showing results for 
Search instead for 
Did you mean: 

Reading the selected row of dynamic table

Former Member
0 Kudos

Dear Experts,

Can anyone let me know how to read the selected row of the source table and the click of "ADD" button the selected row from source table should me moved to targer table and it should be deleted from source table.

The scenario is : I have dynamically created source table and target table having values.Between source table and target table i  have two buttons ADD AND REMOVE records

When i select row in souce table and click on add button,the selected row should be appear in target table and it should get deleted from source table and vice versa.

Awaiting for response.

Katrice

Accepted Solutions (1)

Accepted Solutions (1)

former_member210266
Active Participant
0 Kudos

Hi Katrice

You can do the following :

1. Use the method  get_selected_elements of the souce node, to get the list of elements selected by the user.

  2. Then get the records of the target table by method get_static_attributes_table of the target node.

3. loop on the selected element list from step 1,and get the element values by method GET_STATIC_ATTRIBUTES and append the work area to the target table records obtained from step 2.

4. Remove the selected element by using method remove_element.

5. endloop.

6. Bind target table with the updated records.

Hope this helps.

Regards

Swati

Former Member
0 Kudos

Thanks   Swathi,

Issue resolved .

Thanks

Katrice

Answers (2)

Answers (2)

former_member217546
Participant
0 Kudos

Hi ,

If the UI Element 'Shuttle' is available in your Webdynpro ABAP Framework, it may help you to avoid manual creation of add - remove  buttons and the tricky logic.

Please go with this link it may help you.

http://scn.sap.com/docs/DOC-2293

Thanks,

Sudheer

Former Member
0 Kudos

Thanks Sudheer,

Issue resolved .

Thanks

Katrice

former_member215610
Active Participant
0 Kudos

Hi Katrice Hawkins,

use the below code.

1. To get lead selected data.

DATA lo_nd_<node_name> TYPE REF TO if_wd_context_node.

DATA lo_el_<node_name> TYPE REF TO if_wd_context_element.

DATA ls_<node_name> TYPE wd_this->element_<node_name>.

   lo_nd_<node_name> = wd_context->get_child_node( name = 'NODE_NAME' ).

* get element via lead selection

   lo_el_<node_name> = lo_nd_<node_name>->get_element( ).

* get all declared attributes

   lo_el_<node_name>->get_static_attributes(

     IMPORTING

       static_attributes = ls_<node_name> ).

* ls_<node_name> will contain lead selected line item

2. To append get the reference of target node and use bind_structure method.

lo_nd_employee TYPE REF TO if_wd_context_node.

lo_nd_employee->bind_structure( new_item = ls_<node_name> set_initial_elements = abap_false ).

3. Delete lead selected line item from source

Regards,

Ragavendra

Former Member
0 Kudos

Thanks Ragavendra,

Issue resolved .

Thanks

Katrice