cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch current row data on click of button in ALV table

Former Member
0 Kudos

Hi,

I have Designed a ALV table with 3 columns. The 3rd column contains button "Show Details", when user clicks the button in each row the corresponding row data has to be sent to a Function module to fetch details.

I have created a event handler with the "On_Click" ALV interface controller event. Please help me in fetching the current row data when the user clicks the button in each row.

Regards,

Bala Baskaran.S

Accepted Solutions (1)

Accepted Solutions (1)

former_member186491
Contributor
0 Kudos

Hi,

I had asked same question earlier. I'm providing link thereto, hope this would be helpful --

[;

Thanks.

Kumar Saurav.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Kumar,

Thank you very much...The link you provided helped me in solving the problem.

Using the below code i was able to fetch the current row data and print.

method SHOWDETAILS .
  DATA lo_nd_table TYPE REF TO if_wd_context_node.
  DATA lo_el_table TYPE REF TO if_wd_context_element.
  DATA ls_table TYPE wd_this->element_home_table.
  data lv_propertyno like ls_table-propertyno.
  data lv_location like ls_table-location.

* navigate from <CONTEXT> to <TABLE> via lead selection
  lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).

  lo_el_table = lo_nd_table->get_element( r_param->index ).

  lo_el_table->get_attribute( exporting name = 'PROPERTYNO' Importing value = lv_propertyno ).
  lo_el_table->get_attribute( exporting name = 'LOCATION' Importing value = lv_location ).

  call method lo_message_manager->report_success
    exporting
      message_text             = lv_propertyno.

    call method lo_message_manager->report_success
    exporting
      message_text             = lv_location.

endmethod.

Regards,

Bala Baskaran.S

Former Member
0 Kudos

Hi Bala ,

Write this code in your action to get the details of the row :-

DATA LO_ND_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_NODETYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_NODE TYPE WD_THIS->ELEMENT_NODE.

DATA LT_NODE TYPE STANDARD TABLE OF WD_THIS->ELEMENT_NODE

DATA WA_NODETYPE WD_THIS->ELEMENT_NODE.

navigate from <CONTEXT> to <NODE> via lead selection

LO_ND_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_NODE).

*get element via lead selection

LO_EL_NODE = LO_ND_NODE->GET_ELEMENT( ).

LO_EL_NODE= WDEVENT->GET_CONTEXT_ELEMENT( NAME = 'CONTEXT_ELEMENT' ). "here u get reference for the element,

after that set the lead selection and get element data

IF LO_ND_NODE IS NOT INITIAL.

CALL METHOD LO_ND_NODE->SET_LEAD_SELECTION

EXPORTING

ELEMENT = LO_EL_NODE.

ENDIF.

@TODO handle not set lead selection

IF LO_EL_NODE IS NOT INITIAL.

LO_EL_NODE->GET_STATIC_ATTRIBUTES(

IMPORTING

STATIC_ATTRIBUTES = LS_NODE ).

ENDIF.

Hope this will be helpfull for you.

Thanks & Regards,

Monishankar C

sahai
Contributor
0 Kudos

hi,

pls use lead selection in this case.....in the coding of that button if that event is triggered as you told just read that node by lead selection which is binded to the table displaying its value you will automatically get the values in the row.......

thanks and regards,

sahai.s

Former Member
0 Kudos

hi,,

i think whnever u click on tht button current row automatically gets populated in tht particular node wher u hav binded tht alv...

so if u try reading tht node...u wil get tht particular row....

i hope it works....if u require more information on it.....let me know