Skip to Content
author's profile photo Former Member
Former Member

Reading the selected row of dynamic table

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on May 29, 2013 at 11:41 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2013 at 11:50 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2013 at 03:30 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.