cancel
Showing results for 
Search instead for 
Did you mean: 

Link click on only one row in ALV

Former Member
0 Kudos

Hello Experts,

I have an ALV. the requirement is the to make data in the first row of the table as Link and rest all the data from row 2 in all the columns as read only.

the table will look something like this

Field1 Field2 Field3

<u>Link1</u> <u>link2</u> <u>link3</u>

data data data

data data data

Any pointers to this.

Regards,

kinshuk

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kinshuk,

As far as I know, such a thing is not possible. You will have the same cell-editor for all the rows.

Regards,

Neha

Former Member
0 Kudos

Hi.

You can use cell variants for using different cell editors per row.

Check out webdynpro component SALV_WD_TEST_TABLE_CV.

Cheers,

Sascha

Former Member
0 Kudos

Hi Sascha,

Can you please elaborate on this. when i use the cell variant all the cells in the field becomes link.

what i am trying to do is to make only the row 1 of the field as link

here is the code which i copied and tried


  data:
    lt_columns type salv_wd_t_column_ref,
        lr_column_settings type ref to if_salv_wd_column_settings.

 lr_column_settings ?= lo_value.

  lt_columns = lr_column_settings->get_columns( ).

  data:
    ls_column     type salv_wd_s_column_ref,
    lr_col_header type ref to cl_salv_wd_column_header,
    l_tooltip     type string.

  loop at lt_columns into ls_column.
    lr_col_header = ls_column-r_column->get_header( ).
*... create textview cellvariant for each column
    data:
      lr_cv type ref to cl_salv_wd_cv_standard.

    create object lr_cv.

    lr_cv->set_key( 'TEXT_VIEW' ).

    data:
      lr_textview type ref to cl_salv_wd_uie_text_view.

    create object lr_textview.
    lr_textview->set_text_fieldname( ls_column-id ).

    lr_cv->set_editor( lr_textview ).

    ls_column-r_column->add_cell_variant( r_cell_variant = lr_cv ).

    ls_column-r_column->set_sel_cell_variant_fieldname( 'CELLVARIANT' ).

        data:
          lr_button type ref to cl_salv_wd_uie_button.

        create object lr_button.
        lr_button->set_text_fieldname( ls_column-id ).
        ls_column-r_column->set_cell_editor( lr_button ).

  endloop.

Regards,

kinshuk

Former Member
0 Kudos

Hi.

This is controlled by the field CELL_VARIANT. I guess you do not have such a field in you node structure. Add one field (e.g. via subnode) that controlls which cell editor to add.

Then only in the first row set this field to a special value (e.g. 'LINK').

Each row that contains LINK in this field will use the cell varaint. So if you set it only in the first row, only the first row will show linktoaction.

Then use the above code to create the cell editor for the variant but use the link to action element instead of textview. Then set the normal editor for the column.

Cheers,

Sascha

PS:

In the example component each second row gets the value set:

loop at lt_data into ls_data.

clear ls_data_new.

l_erg = sy-tabix mod 2.

if l_erg eq 0.

ls_data_new-cellvariant = 'TEXT_VIEW'.

else.

endif.

move-corresponding ls_data to ls_data_new.

append ls_data_new to lt_data_new.

endloop.

Message was edited by:

Sascha Dingeldey