cancel
Showing results for 
Search instead for 
Did you mean: 

set_visible_row_count of the if_salv_wd_table_settings doesn't work

Former Member
0 Kudos

Hi!

I've created ALV and now I need dynamically to set number of visible rows to some number.

I call set_visible_row_count method of the reference to the if_salv_wd_table_settings interface but number of rows on the screen doesn't change.

The reference to if_salv_wd_table_settings itself works fine because call of the set_fixed_table_layout( abap_true ) method on the next line of the code works correctly.

Why set_visible_row_count method doesn't work and how this can be fixed?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you did this coding in the 'WDDOMODIFYVIEW' method?

It works fine

Regards

Tamil

Former Member
0 Kudos

Tamil,

I've tryed this coding ind WDDOMODIFYVIEW and result was the same.

I also noticed that there is number of rows parameter in the settings window of the ALV. Could that be that this parameter overrides value set in the code? Like when changing header text programmatically you have to unbind it from dictionary:

lr_alv_header->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).

lr_alv_header->set_text( 'TEST').

UPD1: Actually the behavior slightly changed: number of rows changes but olny after pressing of "Settings" button.

UPD2: The problem is solved! The problem was in the view, which stored unwanted number of rows. It was enough to delete all alv-views.

Thanks everyone!

Answers (1)

Answers (1)

former_member189058
Active Contributor
0 Kudos

Hello,

Is there any error???

Can u paste your code snippet here?

Regards,

Reema.

Former Member
0 Kudos

Hi!

There is no syntax error. But number of visible rows just doesn't change. Here is my code:

data:
    lr_cmp_usage type ref to if_wd_component_usage,
    lr_com_controller_if type ref to iwci_salv_wd_table,
    lr_alv_config type ref to cl_salv_wd_config_table,
    lr_alv_column type ref to cl_salv_wd_column,
    lr_alv_header type ref to cl_salv_wd_column_header,
    lr_table_setting type ref to if_salv_wd_table_settings.
  .
  constants:
    abap_true type flag value 'X',
    abap_false type flag value ' '
  .


* get alv config object
  lr_cmp_usage = wd_this->wd_cpuse_alv1( ).

* ggf objekt instanziieren
  if lr_cmp_usage->has_active_component( ) is initial.
    lr_cmp_usage->create_component( ).
  endif.
  lr_com_controller_if = wd_this->wd_cpifc_alv1( ).
  lr_alv_config = lr_com_controller_if->get_model( ).
  lr_table_setting ?= lr_alv_config.

* get column & header object
  lr_alv_column =
    lr_alv_config->if_salv_wd_column_settings~get_column( 'ZZSRM_BID_PQCLS' ).
  lr_alv_header = lr_alv_column->get_header( ).


  constants: length1 type string value '60'.
  constants: length2 type string value '100'.
  lr_alv_column = lr_alv_config->if_salv_wd_column_settings~get_column( 'ZZSRM_BID_PQCLS' ).
  lr_alv_column->set_width( value = length1 ).


  lr_table_setting->set_fixed_table_layout( abap_true ).
  lr_table_setting->set_visible_row_count( 50 ).
  data cnt type i.
  cnt = lr_table_setting->get_visible_row_count( ).

Few notes:

1) call of set_fixed_table_layout( abap_true ) works fine and changes the behavior of the ALV.

2) get_visible_row_count( ) called after set_visible_row_count returns number 50 (which was passed to set_visible_row_count previously)

3) this code is called in defauld inbound plug of type "startup" of main window.