cancel
Showing results for 
Search instead for 
Did you mean: 

Link on ALV output column

Former Member
0 Kudos

Hi Experts,

In my ALV output table i want to put a link for one column so that when user click on that link it'll call another view of the same applications .Please remember the output is on ALV not in any table .

Please give me solution.

Regards,

Satya

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I problem is solved , Thanks for your help and support

Satya

Former Member
0 Kudos

Hi,

DATA:

lr_comp_alv TYPE REF TO if_wd_component_usage,

lr_comp_if_alv TYPE REF TO iwci_salv_wd_table,

lr_config TYPE REF TO cl_salv_wd_config_table,

lr_column TYPE REF TO cl_salv_wd_column,

ls_column TYPE salv_wd_s_column_ref,

lt_columns TYPE salv_wd_t_column_ref.

data: lr_column_settings TYPE REF TO if_salv_wd_column_settings.

data: lr_link type ref to CL_SALV_WD_UIE_LINK_TO_ACTION.

*... ALV Component Usage

lr_comp_alv = wd_this->wd_cpuse_alv( ).

IF lr_comp_alv->has_active_component( ) IS INITIAL.

lr_comp_alv->create_component( ).

ENDIF.

lr_comp_if_alv = wd_this->wd_cpifc_alv( ).

*... Configure ALV

lr_config = lr_comp_if_alv->get_model( ).

  • lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).

  • lr_config->if_salv_wd_std_functions~set_edit_insert_row_allowed( ).

lr_config->if_salv_wd_std_functions~set_view_list_allowed( abap_false ).

lr_config->if_salv_wd_std_functions~set_export_allowed( abap_true ).

lt_columns = lr_config->if_salv_wd_column_settings~get_columns( ).

lr_column = lr_config->if_salv_wd_column_settings~get_column('OBJID' ).

CREATE OBJECT lr_link.

lr_link->set_text_fieldname( 'OBJID' ).

lr_column->set_cell_editor( lr_link ).

Former Member
0 Kudos

Hi Sridevi ,

I ve put the code in my doinit() but now i am getting some error wd_cpuse_alv is unknown . Can u please tell me what are the attributes your are using .

Regards,

Satya

Former Member
0 Kudos

Hello,

Like I wrote in my last reply:

Go to the Properties tab of the view and look for the SALV_WD_TABLE component.

So you need to use the following: wd_this->wd_cpuse_SALV_WD_TABLE_NAME.

Regards,

Former Member
0 Kudos

Hi David,

I am bit confused with you. I m using the SALV_WD_TABLE as used component and in the Component Controller also i am using as below as used component .

ALV SALV_WD_TABLE ALV Component

ALV SALV_WD_TABLE INTERFACECONTROLLER

So i think there is no need to create /call the component at runtime .

So i am using few lines of code as below in doinit( ).

lt_columns = lr_config->if_salv_wd_column_settings~get_columns( ).

lr_column = lr_config->if_salv_wd_column_settings~get_column( 'OBJID' ).

CREATE OBJECT lr_link.

lr_link->set_text_fieldname( 'OBJID' ).

lr_column->set_cell_editor( lr_link ).

So now its getting dump . Have allok into it and let me know what i need to do .

Former Member
0 Kudos

Hello Satya,

You need to create an method to define the attributes of the column that will have the link like follow:


METHOD display_alv .
  DATA: lr_alv_usage       TYPE REF TO   if_wd_component_usage,
        lr_config          TYPE REF TO   cl_salv_wd_config_table,
        lr_col_header      TYPE REF TO   cl_salv_wd_column_header,
        lr_function_wd     TYPE REF TO   cl_salv_wd_function,
        lr_button          TYPE REF TO   cl_salv_wd_fe_button,
        lr_image           TYPE REF TO   cl_salv_wd_uie_image,
        lr_header          TYPE REF TO   cl_salv_wd_header,
        lr_uie_link        TYPE REF TO   cl_salv_wd_uie_link_to_action,
        lr_if_controller   TYPE REF TO   iwci_salv_wd_table,
        lr_function_set    TYPE REF TO   if_salv_wd_function_settings,
        lr_table_settings  TYPE REF TO   if_salv_wd_table_settings,
        lr_column_settings TYPE REF TO   if_salv_wd_column_settings.
 
  DATA: lt_columns         TYPE          salv_wd_t_column_ref,
        ls_column          TYPE          salv_wd_s_column_ref,
        lv_text            TYPE          string.
 
* Instantiate ALV Component
  lr_alv_usage = wd_this->wd_cpuse_all_alv( ).
  IF lr_alv_usage->has_active_component( ) IS INITIAL.
    lr_alv_usage->create_component( ).
  ENDIF.
 
* get reference to model
  lr_if_controller = wd_this->wd_cpifc_all_alv( ).
  lr_config        = lr_if_controller->get_model( ).
 
* modify visible rows
  lr_config->if_salv_wd_table_settings~set_visible_row_count( iv_rows ).
  lr_config->if_salv_wd_table_settings~set_selection_mode(
                                       wd_assist->co_alv_selmode ).
 
* create function
  lr_function_set ?= lr_config.
  lr_function_wd = lr_function_set->create_function(
                   wd_assist->co_func_det_nfe ).
 
  CREATE OBJECT lr_button.
*read text
  lv_text = wd_assist->read_text( iv_key = '002' ).
  lr_button->set_text( lv_text ).
  lv_text = wd_assist->read_text( iv_key = '001' ).
  lr_button->set_tooltip( lv_text ).
  lr_button->set_image_source( wd_assist->co_icon_seldet ).
  lr_function_wd->set_editor( lr_button ).
 
* set table header
  lr_table_settings ?= lr_config.
  lr_header = lr_table_settings->get_header( ).
  lv_text = wd_assist->read_text( iv_key = '003' ).
  lr_header->set_text( lv_text ).
  lv_text = wd_assist->read_text( iv_key = '004' ).
  lr_header->set_tooltip( lv_text ).
  lr_header->set_image_source( wd_assist->co_icon_list ).
 
  lr_column_settings ?= lr_config.
  lt_columns = lr_column_settings->get_columns( ).
 
  LOOP AT lt_columns INTO ls_column.
    CASE ls_column-id.
      WHEN 'ICON'.
        CREATE OBJECT lr_image.
        lr_image->set_source_fieldname( ls_column-id ).
        lr_image->set_tooltip_fieldname( 'ICON_TOOLTIP' ).
        ls_column-r_column->set_cell_editor( lr_image ).
      WHEN 'ID'.
        CREATE OBJECT lr_uie_link.
        lr_uie_link->set_text_fieldname( ls_column-id ).
        ls_column-r_column->set_cell_editor( lr_uie_link ).
      WHEN 'ICON_TOOLTIP' or 'LOGSYS'.
        ls_column-r_column->set_visible(
                           cl_wd_uielement=>e_visible-none ).
    ENDCASE.
 
*set header binding of medium description, otherwise title
    lr_col_header = ls_column-r_column->get_header( ).
    lr_col_header->set_ddic_binding_field(
                        if_salv_wd_c_column_settings=>ddic_bind_medium ).
  ENDLOOP.
 
ENDMETHOD.

Here will be showed an icon (column ICON) and an link (column ID).

Regards,

Former Member
0 Kudos

Hello David,

Thanks for the quick response .Do i need to call this method in DoINIT or some whereelse.

Regards,

Satya

Former Member
0 Kudos

Yes, you need to call it (I suggest you to call it in the WDDOMODIFYVIEW ).

Regards,

Former Member
0 Kudos

Hi David ,

I am getting some error , wd_cpuse_all_alv is unknown .Can u please tell me what are the attibutes include i that view .

Its bit urgent ..please help me

Regards,

Satya

Edited by: satya pujahari on May 12, 2008 8:40 PM

Former Member
0 Kudos

Hello,

Go to the Properties tab of the view and look for the SALV_WD_TABLE component.

So you need to use the following: wd_this->wd_cpuse_SALV_WD_TABLE_NAME.

Or you can do the following: in you view, you can click the button DISPLAY CONTROLLER INTERFACE, select current controller and then look for component & controller usages and find the method that returns the alv table.

Regards,