Skip to Content
0
Former Member
Mar 05, 2009 at 02:23 PM

Get lead select of table onclick of button

210 Views

Hi ,

I want to capture the lead selected row field value onclick of a button. I have a table where user will select a row. But I need to capture the value of a field in the table on click of another button.

I used the code as below, which always fetches the first record. Need help on this.

DATA lo_nd_variant_tab TYPE REF TO if_wd_context_node.

DATA lo_el_variant_tab TYPE REF TO if_wd_context_element.

DATA ls_variant_tab TYPE wd_this->element_variant_tab.

DATA lv_variant LIKE ls_variant_tab-variant.

  • navigate from <CONTEXT> to <VARIANT_TAB> via lead selection*

lo_nd_variant_tab = wd_context->get_child_node( name = wd_this->wdctx_variant_tab ).

  • @TODO handle not set lead selection*

IF lo_nd_variant_tab IS INITIAL.

ENDIF.

  • get element via lead selection*

lo_el_variant_tab = lo_nd_variant_tab->get_element( ).

  • @TODO handle not set lead selection*

IF lo_el_variant_tab IS INITIAL.

ENDIF.

  • alternative access via index*

  • lo_el_variant_tab = lo_nd_variant_tab->get_element( index = 1 ).*

  • @TODO handle non existant child*

  • IF lo_el_variant_tab IS INITIAL.*

  • ENDIF.*

  • get single attribute*

lo_el_variant_tab->get_attribute(

EXPORTING

name = `VARIANT`

IMPORTING

value = lv_variant ).