cancel
Showing results for 
Search instead for 
Did you mean: 

Icon as hyperlink

ArtiBhat
Associate
Associate
0 Kudos

Hi all,

I need help in setting Icon as a hyperlink in Column of ALV.

I am implementing it as

CREATE OBJECT lr_linktourl.

lr_linktourl->set_image_source_fieldname( 'EXCEPTION_URL' ).

lr_col->set_cell_editor( lr_linktourl ).

but no icon in getting displayed.

Regards,

Arti.

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi Arti,

>> I used a button, and put an image.

  data: lr_column    type ref to cl_salv_wd_column,
        lr_button    type ref to cl_salv_wd_uie_button.

  lr_column = lr_table->if_salv_wd_column_settings~get_column( 'CARD_ICON' ).
  
  create object lr_button.
  lr_button->set_image_source_fieldname( 'CARD_ICON' ).
  lr_column->set_cell_editor( lr_button ).

>> if a value does not exist, cell type is changed a textview type.

  data: lt_columns  type salv_wd_t_column_ref,
        ls_column   type salv_wd_s_column_ref.
  data: lr_column_settings type ref to if_salv_wd_column_settings,
        lr_cv              type ref to cl_salv_wd_cv_standard,
        lr_textview        type ref to cl_salv_wd_uie_text_view.

  lr_column_settings ?= lr_table.
  lt_columns = lr_column_settings->get_columns( ).

  create object lr_cv.
  lr_cv->set_key( 'TEXT_VIEW' ).

  create object lr_textview.

  loop at lt_columns into ls_column.
    
    if ls_column-id = 'CARD_ICON'.
      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( 'CARD_CELLVARIANT' ).
    endif.

  endloop.

>> values in an internal table

BELNR       BUDAT     ...   CARD_ICON               CARD_CELLVARIANT
1900000001  20071001  ...   ICON_PATIENT_SMARTCARD  
1900000002  20071001  ...                           TEXT_VIEW
1900000003  20071002  ...   ICON_PATIENT_SMARTCARD
1900000004  20071002  ...                           TEXT_VIEW
1900000005  20071003  ...                           TEXT_VIEW
1900000006  20071004  ...                           TEXT_VIEW
1900000007  20071004  ...   ICON_PATIENT_SMARTCARD

Sorry, my poor english.

Regards,

haecheol.

Former Member
0 Kudos

Hi Arti,

First of all i suppose your object <b>lr_linktourl</b> is of reference type cl_salv_wd_uie_link_to_action.

Now apart from setting the image source field name its important to set whether you want to show the image or not using the method

<b>set_image_first</b> to either TRUE OR FALSE.

And i hope the field 'EXCEPTION_URL' that you are binding contains the node attribute which has image source path.

If you do this i hope image should be shown in the ALV table.

To do some action on click of that image you will have to write an event handler for event ON_FUNCTION for our ALV and inside that you can get the URL and open a new window/popup or do any kind of processing which you want to do.

Thanks

Aditya

Former Member
0 Kudos

Do you have a field by name EXCEPTION_URL in your context? This field should be of type string, and you need to populate the ICON name in it. Have you done that? Check if the field exception_url actually contains a valid image source.

Regards

Nithya

Former Member
0 Kudos

Hi,

Idon't know what the image is exactly,

but I couldn't find that one in my system,

try ICON_URL or

ICON_WD_LINK_TO_URL

this might give the hoped result

grtz,

Koen

ArtiBhat
Associate
Associate
0 Kudos

Hi koen,

Thanks for the reply.

Could you please tell me what is ICON_WD_LINK_TO_URL.

Rgds,

Arti.

Former Member
0 Kudos

Hi,

that's the icon used in the layout designer to declare a link to url ui-element,

the other one is the standard link icon in SAP

grtz,

Koen