cancel
Showing results for 
Search instead for 
Did you mean: 

Set the Visible Column count in a ALV - Webdynpro

Former Member
0 Kudos

Hi Experts,

I have a requirement where i have to set the no of visible Columns on my ALV. Any idea how i can set the visible columns programatically?

Thanks in Advance!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

This issue in general must be resolved by using the scrollable column count. For my specific case these might be an issue some other point which i have to investigate.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos
data: l_ref_cmp_usage type ref to if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).  "Adjust for your component usage name - mine is ALV
  if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
  endif.

  data l_salv_wd_table type ref to iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv( ).  "Again adjust for your component usage name
  data l_table type ref to cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).

 data l_column type ref to cl_salv_wd_column.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'CLIENT' ).
  l_column->set_visible( cl_wd_uielement=>e_visible-none ).
Former Member
0 Kudos

Hi Tomas,

As i understand this code will show a particular column. but i am actually looking for the' Number of columns',

Example: I want to display 10 columns.

How can i specify the no '10'

The issue in my case what every i do there are only 10 columns visible on my ALV the 11 the columns is becoming scrollable. I have tried adjusting the width still this is hapening. so when i right click on my ALV a pop up opens with 4 tabs the 4 th tab 'DISPLAY' has a parameter No of Visible columns as '10' . I want to programatically change it to 11. So that it becomes common to all the user.

Thanks!!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That is easy to do as well. Building upon the above code to get the SALV Model:

l_table->if_salv_wd_table_settings~set_scrollable_col_count( 11 ).

Former Member
0 Kudos

Hi Thomas,

Thanks for all ur input!!

But although i set the scrollable column count to 11 it is not working. If i again right click on my ALV>> select the user detail settrngs>>and go to the display tab the no of visible columns is still showing as 10.

Do you think we have any way by which this field can be updated programatically.

Thanks!!