cancel
Showing results for 
Search instead for 
Did you mean: 

make hyperlink or input field based on condition in ALV column.

Former Member
0 Kudos

HI,

I have a requirment like in my ALV display one column has hyperlink. Now if you have records in a row thn it will show as a hyperlink. If not then the row will be blank and open for input.

In class CL_SALV_WD_UIE_LINK_TO_ACTION i have method SET_ENABLED_FIELDNAME. But no method to make editable.

Is it possible and how? Waiting for your valuable comments.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks guys for ur replies, i have done it.

Former Member
0 Kudos

hi, MonishankarC.

To your requirement, i suggest you use Cell_variant for your ALV, just like the normal TABLE.

I.e: when there is data for the record, you should use "Link_to_action" as the celll-editor which the cell_variant "L2A"(link to action) has.This point, you have already said...When no data, you should use "cl_salv_wd_uie_input_field" as your cell editor"IPT"(input field) which the cell_variant has..

Then, you can set the ALV column has different cell variant correspondingly.

l



* access column settings
  lr_column_settings ?= l_value.
  lt_columns = lr_column_settings->get_columns( ).

  LOOP AT lt_columns INTO ls_column.

"here, cell variant can be set on condition, which you can manipulate.."L2A" or "IPT"
s_column-r_column->set_sel_cell_variant_fieldname( 'CELLVARIANT' ).

endloop.

I don't know whether i am clear or fit your requirement.

Hope it can help u a little.

Best wishes.

Former Member
0 Kudos

HI Can Tang,

Sorry for being late, I have tried to use cell variant but unable get it. Any sample code containing hyperlink and cell variant.

Former Member
0 Kudos

DATA lr_lta type ref to cl_salv_wd_uie_link_to_action.

DATA lt_columns type salv_wd_t_column_ref,

field-symbols:

<wa_colum> type salv_wd_s_column_ref.

lt_columns = l_table->if_salv_wd_column_settings~get_columns( ).

loop at lt_columns[] assigning <wa_colum>.

case <wa_colum>-id.

when 'Column id here'.

create object lr_lta.

lr_lta->set_text_fieldname('Give a fieldname from context binding' ).

lr_lta->set_tooltip_fieldname( 'Give a fieldname from context binding' ).

lr_lta->set_type( cl_wd_link_to_action=>e_type-navigation ).

<wa_colum>-r_column->set_cell_editor( lr_lta ).

free lr_lta.

when others.

ENDLOOP.