cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Select of Row in a table in webdynpro Abap

Former Member
0 Kudos

Hi,

I have an requirement, I have an table and a button, I need to select a row in a table based on button action.

For example : in a table i have 3 rows. I am submiting a value in a button, I want to see that row highlighted for the value I am sending through button.

Please let us know the code how to implement this.

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

solved my self

Former Member
0 Kudos

Dear lavanya,

I have a very similar problem now.

I want to select a certain row in an alv grid after a button has been pressed.

Unfortunately I have not been able to solve that on my own so far.

Could you post your solution here?

Former Member
0 Kudos

Hi,

First you have to go to table and set its property "SELECTION MODE" to single or multi lead depending on ur need.

Then in the ACTION of the button you can use the following code to get the values in the selected row.

DATA:

  • node to get table node for finding no. of rows

lo_nd_one TYPE REF TO if_wd_context_node,

  • Get selected row for finding no. of rows

it_table TYPE wdr_context_element_set,

  • workarea to get selected row

wa_table LIKE LINE OF it_table,

  • To get the Selected line item into an internal table

CALL METHOD lo_nd_one->get_selected_elements

RECEIVING

set = it_table. " data in internal format

IF it_table[] IS NOT INITIAL.

  • type conversion for work area

READ TABLE it_table INTO wa_table INDEX 1.

  • if a row is present

IF sy-subrc IS INITIAL.

  • Get the values of each attribute

CALL METHOD wa_table->get_static_attributes

IMPORTING

static_attributes = wa_final. "<Selected data in work area.> ---> this will have your data

ENDIF.

Here wa_final is the work area which is of your table fields type.

This wa_final will have the selected row.

Former Member
0 Kudos

Use method SET_LEAD_SELECTION_INDEX of method if_wd_context_node, by passing the Index in the exporting parameter.