cancel
Showing results for 
Search instead for 
Did you mean: 

Help on displaying buttons within a table UI element.

Former Member
0 Kudos

Hi all,

I have a Webdynpro table UI Element in which the last column is a button ie. I've gone to the table Binding and set the Cell Editor of the last column to be of type button . The table selection mode is set to Auto and the context node for the table has cardinality 0..n and Selection of 0..1.

so far so good.

When I code the ACTION for the button, I want it to react specifically to the element/data in that row where the CLICKED button is.

So the code (just produced by the standard Wizard) looks like this :

DATA lo_nd_partner_details TYPE REF TO if_wd_context_node.

DATA lo_el_partner_details TYPE REF TO if_wd_context_element.

DATA ls_partner_details TYPE wd_this->element_partner_details.

  • navigate from <CONTEXT> to <PARTNER_DETAILS> via lead selection

lo_nd_partner_details = wd_context->get_child_node( name = wd_this->wdctx_partner_details ).

  • get element via lead selection

lo_el_partner_details = lo_nd_partner_details->get_element( ).

  • Fill up values in assistance class

  • get all declared attributes

lo_el_partner_details->get_static_attributes(

IMPORTING

static_attributes = ls_partner_details ).

However after executing the get_element() method, there's nothing in lo_el_partner_details ie. Clicking on the button in the row does not cause SAP to recognize the row as selected. So my question is , how do I retrieve the contents of the particular row for which I've clicked that button ??

Regards,

Gabriel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gabriel,

You need to get the Index of the table row using the Context Element from the WDEVENT parameter inside the Click Button Method.

The Code something goes like this:

  DATA context_element TYPE REF TO if_wd_context_element.
  data lv_index type i.

  context_element =  wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).

  context_element->get_index(
    RECEIVING
     my_index = lv_index ).

Check the above code and try getting the index of the table, and using the index of the table row, you can get the data using the Get_element() method.

Revert in case of any issues.

Regards,

-Syed.

Edited by: wahid hussain syed on May 4, 2010 10:14 AM

ChrisPaine
Active Contributor
0 Kudos

Hello,

when you create the action for the button - there is a little checkbox - about passing UI parameters? Checking this should automatically populate the parameters into the action handler method. If you forgot to check this box, then you can add the UI parameters back into the action and method handler by clicking on the Action tab and clicking on the icon (looks a bit like a little square from memory).

Context_element is one of these parameters (NB it refers to the element of the table - which I believe is your requirement!)

Not sure why you would ask of the element what index it was in the node - just to read it again using "get_element".

Chris

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks to everyone for input. Chris, your suggestion was best. Works perfectly now

Gabriel

Former Member
0 Kudos

Hi,

Have you tried to create a menu toolbar button with in the Table UI element. On this menu button you can set the code to select the row, which you have selected.

Hope it works for you..