cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the selected row in the table....

Former Member
0 Kudos

Hi...

I want to know which row is selected in my table.

since i m not using the lead selection i cant use get_index...

I m having a checkbox in my table when i check it, i want to know which row is selected...

How to solve this issue....

Thanks & Regards.

Kalpanashri Rajendran.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Found the Solution...

Dynamically pass the leadselection...

use method GET_LEAD_SELECTION_INDEX

get the index number & get the value using the index.

Former Member
0 Kudos

Hi Kalpanashri,

I am also facing same problem, plz tell me what is meant by pass lead selection dynamically or how to do that.

can you provide the some sample code for that.?.

Regards,

Rohit

uday_gubbala2
Active Contributor
0 Kudos

Hi Rohit,

You can try use the code snippet that I had mentioned in this[ thread|;. Here too the user wanted to get to know which row the user was clicking up on & the table had the selecionmode set to none.

Regards,

Uday

Former Member
0 Kudos

Rohit you can use code written by me, this will also find the row in which check box is clicked without lead selection

Yogesh N

Former Member
0 Kudos

hi,

this will solve your problem.

use this code in ontoggel event of ur check box

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.

DATA INT TYPE I.

  • 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.

"in ls_node you have the row u click without lead selection

Edited by: Yogesh N on Oct 1, 2008 8:06 AM

Former Member
0 Kudos

Hello,

You can do something like this:


  DATA:
    lr_node     TYPE REF TO  if_wd_context_node,
    lt_data    TYPE         zwdtmass,
    lr_data    TYPE REF TO  zwdsmass,
    lt_download TYPE         zwdtdownload,
    ls_download LIKE LINE OF lt_download.

    lr_node = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
    lr_node->get_static_attributes_table( IMPORTING table = lt_data ).

    LOOP AT lt_data REFERENCE INTO lr_data WHERE selected = abap_true.
      ls_download-id    = lr_data->id.
      ls_download-ztype = lr_data->ztype.
      ls_download-docid = lr_data->docid.
      APPEND ls_download TO lt_download.
    ENDLOOP.

In the code SELECTED is the field that contains the value from the checkbox.

Regards.