5 Replies Latest reply: May 29, 2008 8:22 AM by Guest RSS

Hide column of an ALV table completely

Karin Koerner
Currently Being Moderated


I have a context attrribute "INTERNAL_KEY". This attribute is used for a column of an ALV table and holds the internal key of an object.


Acutally I set the attribute invisible, because the user shouldn't see this attribute. The problem is that the user can set the attribute visible through the ALV-settings pop-up. Is there a possiblity to avoid that this attribute is shown in the ALV-settings pop-up ( without removing the attribute from the context) .


Thanks for your help,


  • Re: Hide column of an ALV table completely
    parag bhise
    Currently Being Moderated

    Hi ,

    See demo Example  <b>WDT_TEST_TABLE</b> .

    and Package <b>SALV_WD_DEMO</b>.It will may help you .




  • Re: Hide column of an ALV table completely
    Abhimanyu Lagishetti
    Currently Being Moderated

    Hi Karin,


    DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .

    l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

    DATA: l_value TYPE REF TO cl_salv_wd_config_table.

    l_value = l_ref_interfacecontroller->get_model( ).

    data: l_col type ref to CL_SALV_WD_COLUMN

    l_col = l_value->if_salv_wd_table_settings~get_column( 'INTERNAL_KEY' ).




    Abhimanyu L

  • Re: Hide column of an ALV table completely
    Thomas Jetzinger
    Currently Being Moderated

    to hide columns in the settings popup too use:


    lr_model->if_salv_wd_column_settings~delete_column( 'COLUMN_ID' ).

  • Re: Hide column of an ALV table completely
    chythanya venkat
    Currently Being Moderated


    u can hide the column using the following code.


    Data declaration:

    data lo_cmp_usage type ref to if_wd_component_usage.


    lo_cmp_usage =   wd_this->wd_cpuse_alv_usage( ).

    if lo_cmp_usage->has_active_component( ) is initial.

      lo_cmp_usage->create_component( ).



    • Get the configuration model. Call interface method GET_MODEL.

      DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .

      l_ref_interfacecontroller =   wd_this->wd_cpifc_alv_usage( ).


      DATA: lo_config_model_value TYPE REF TO cl_salv_wd_config_table.

      lo_config_model_value = l_ref_interfacecontroller->get_model( ).

      DATA: lo_column TYPE REF TO cl_salv_wd_column.


    lo_column = lo_config_model_value->if_salv_wd_column_settings~get_column( 'CARRID' ).

      lo_column->set_visible( if_wdl_core=>visibility_blank ).

      CLEAR lo_column.

      lo_column = lo_config_model_value->if_salv_wd_column_settings~get_column( 'CONNID' ).

      lo_column->set_visible( if_wdl_core=>visibility_blank ).




  • Re: Hide column of an ALV table completely
    Currently Being Moderated


    if you want to hide a column named OBJID then implement following coding


          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.

    *... 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( ).



      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' ).

    *To hide particular coulmn

    LOOP AT lt_columns INTO ls_column.


        CASE ls_column-id.


    •     when 'OBJID'.

    •        ls_column-r_column->set_visible( value  = '99' ).


          when 'OBJTP'.

            ls_column-r_column->set_visible( value  = '99' ).