Skip to Content
author's profile photo
Former Member

Create linkToUrl in ALV with different references???


i use an alv and want to show in one column only linkToUrl-UI's. I can do that with the following piece of code, but the problem is that every referece and text of my linkToUrl is the same.

How can i give the LinkToUrl-UI's in my ALV different text and references?

*... Invoke a method of the ALV Interfacecontroller
  DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  l_ref_interfacecontroller =   wd_this->wd_cpifc_usage_alv( ).

* get Model
  DATA: lr_cmdl TYPE REF TO cl_salv_wd_config_table.
  lr_cmdl = l_ref_interfacecontroller->get_model( ).

  DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
  DATA: lr_column TYPE REF TO cl_salv_wd_column.

*  get Column
  lr_column_settings ?= lr_cmdl.
  lr_column = lr_column_settings->get_column( 'DESCR' ).

* create LikToUrl
  DATA lr_link TYPE REF TO cl_salv_wd_uie_link_to_url.
  CREATE OBJECT lr_link.
  lr_link->set_text( 'Open Document' ). 
  lr_link->set_reference( '' ).
  lr_column->set_cell_editor( lr_link ).



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 10:26 AM

    Hi Sharam,

    Yes, you can do it. Introduce two attributes in the same context node, say 'LINK_TEXT' and 'LINK_URL' of type string. When you create the link to url and make it your cell editor, add the following piece of code:

    lr_link->set_text_fieldname( 'LINK_TEXT' ).

    lr_link->set_reference_fieldname( 'LINK_URL' ).

    Now when you populate your internal table to display data, populate these fields accordingly. The text will be taken dynamically from the field link_text and the url will be taken from link_url.

    Hope this helps.



    Add comment
    10|10000 characters needed characters exceeded