cancel
Showing results for 
Search instead for 
Did you mean: 

Row Select in ALV

Former Member
0 Kudos

I have an alv that displays data from a few tables.

If I select a row from teh ALV, then the following screen should display some of the fields of the row along with additional information..

I understand that the ON_CLICK event should be used once the row is selected..However, I would appreciate it if someone gave me more info on the same..

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you select a row in ALV the event asociated is "ON_LEAD_SELECT" . If you create a method asociated to this event, plz put this code in the method asociated:

<i> DATA: lr_index TYPE REF TO if_salv_wd_table_lead_select,

lv_line type SYTABIX.

lr_index ?= r_param.

MOVE lr_index->index TO lv_line.

</i>

In the variable lv_line you will have the selected line of alv.

Former Member
0 Kudos

Thanks ASM!

One thing though..

lv_line seems to contain the index of my row selected.. How do I access the field values from the selected row?

Former Member
0 Kudos

Use the method node->get_element( index = lv_line ) on your context node. That will return the element, and then do get_static_attributes as usual to get the row data.

regards

Nithya

Former Member
0 Kudos

Hi,

Tray this:

<i> DATA: lr_table TYPE REF TO cl_salv_wd_table_lead_select,

lr_node TYPE REF TO if_wd_context_node,

lv_field1 TYPE (field1 of your alv table ).

lr_table ?= r_param.

lr_node ?= wd_context->get_child_node( 'NODE_TABLE' ).

CALL METHOD lr_node->get_attribute

EXPORTING

index = lr_table->IF_SALV_WD_TABLE_LEAD_SELECT~INDEX

name = 'FIELD1'

IMPORTING

value = lv_field1.

</i>

With this code, you will have the value of the field 1 of the selected row.