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

How to get the selection in a table when user presses a button?

Hi, I have a question:

I've got a table ui element with a field NAME as one of the columns of the table. I also got a button for each line in the table.

When the user presses this button on one specific line in the table I would like to read the attribute NAME for this line. But in order to fulfill that

I need to select the item/line (set the selection) before pressing the button, if not selecting the item first I always get the NAME of the item selected.

The user does not want to select the item first, only click on the button.

Anyone who knows how to read the correct value of column name of the line from where the user has clicked on the button?

Thank you and regards Lena

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jul 04, 2012 at 12:56 PM

    Hi,

    Use the parameter WDEVENT:

        DATA: context_element TYPE REF TO if_wd_context_element,
    ls_table TYPE wd_this->element_"your_node_name".

    context_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
    context_element->get_static_attributes( IMPORTING static_attributes = ls_table ) .

    Or you can create a new parameter in your action with the name CONTEXT_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT and the system will fill it with the correct instance.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 04, 2012 at 05:46 PM

    Hi Lena,

    As per my understanding, you need the data of the row of a table, where button is clicked?

    Solution:

    1. When you click on the button, capture the index. Based on the index get the value of the name.

    Data : lo_nd_table type ref to if_wd_context_node,

    lo_el_table type ref to if_wd_context_element,

    ls_table type wd_this->elements_table, ( Table is the name of the node )

    lv_name type wd_this->element_table-name.

    lo_nd_table = wd_context->get_child_node( 'TABLE' ).

    lo_el_table = wd_event->get_context_element( 'CONTEXT_ELEMENT' ).

    lo_el_table->get_attribute( exporting name = 'NAME' importing value = lv_name ).

    Have a check and reply if you issues not solved.

    Regards,

    Sankar Gelivi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 05, 2012 at 11:49 AM

    Check the below document,

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

    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.