cancel
Showing results for 
Search instead for 
Did you mean: 

ALV sorting and scrolling

Former Member
0 Kudos

Hi,

I have 4 questions regarding the ALV. Maybe they are based on one and the same problem?!

1.) Why I can't sort the columns by clicking the header?

I used the method set_sort_headerclick_allowed. See code below.

2.) Why the scrollbar doesn't work?

In the application I defined the parameter WDTABLENAVIGATION = SCROLLBAR

but the scrollbar doesn't work.

3.) Why the paging in the footer doesn't work?

4.) Why the filtering doesn't work? Nothing happens when I want to filter.

Does all 4 problems based on the same error?

It seems to me that something is fix?!

DATA:
    lr_salv_wd_table      TYPE REF TO iwci_salv_wd_table,
    lr_config             TYPE REF TO cl_salv_wd_config_table,
    lr_table_settings     TYPE REF TO if_salv_wd_table_settings,
    lr_standard_functions TYPE REF TO if_salv_wd_std_functions,
    lr_column_settings    TYPE REF TO if_salv_wd_column_settings,

 lr_salv_wd_table = wd_this->wd_cpifc_salv_wd_table( ).

 lr_config = lr_salv_wd_table->get_model( ).
 lr_table_settings ?= lr_config.
 lr_standard_functions ?= lr_config.

 lr_standard_functions->set_sort_headerclick_allowed( abap_true ). 
 lr_standard_functions->set_sort_complex_allowed( abap_true ).

Thanks, regards

Susanne

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Uday,

thanks for testing. But now I am at a loss cause we have:

SAP Basis Component and Cross-Application Component release 7 & level 15

SAP Application Platform 7 & level 12.

I don't realy know which component is responsible for the alv but I think it should work.

At the moment I have no idea what the problem could be.

Regards,

Susanne

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Filtering, Sorting and of course scrolling should work out of the box without any coding against the ALV model. Especially the scrolling. You shouldn't really be able to do anything that breaks the scrolling. Do the ALVs work in the SAP standard sample applications?

Former Member
0 Kudos

Hi Thomas,

it was a good tip to try the alv in a standard application cause there it works. Meanwhile I found my error.

I compare the two application and noticed that I use two WD components in my failed application (one for providing data and one for supplying data). The error was that I put the code into the method (WDDOMODIFYVIEW) which is always building new. So when I filter/sort/page the alv I get always the default data.

What a silly mistake. Now it works, thank you.

Regards, Susanne

Answers (3)

Answers (3)

uday_gubbala2
Active Contributor
0 Kudos

Hi Susanne,

I did give it a try with similar coding that you had mailed to me and the filter, sorting & scrolling functionalities are working fine. I have used the below coding for initializing my ALV:

METHOD build_alv .
  DATA:
    lr_alv_usage       TYPE REF TO if_wd_component_usage,
    lr_if_controller   TYPE REF TO iwci_salv_wd_table,
    lr_config          TYPE REF TO cl_salv_wd_config_table,
    lr_filter          TYPE REF TO if_salv_wd_std_functions.

" Instantiate the ALV Component
  lr_alv_usage = wd_this->wd_cpuse_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_alv( ).
  lr_config        = lr_if_controller->get_model( ).

" Set the UI elements.
  lr_filter          ?= lr_config.

" Specify the setting for using ALV filter
  lr_filter->set_filter_complex_allowed( value = abap_true ).

  DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
  lr_table_settings ?= lr_config.
  lr_table_settings->set_enabled( abap_true ).
  lr_table_settings->set_row_selectable( abap_false ).
  lr_table_settings->set_design( cl_wd_table=>e_design-alternating ).
  lr_table_settings->set_top_of_list_visible( abap_true ).
  lr_table_settings->set_visible_row_count( 3 ).

  lr_filter->set_sort_headerclick_allowed( abap_true ).
  lr_filter->set_filter_filterline_allowed( abap_true ).
  lr_filter->set_sort_complex_allowed( abap_true ).
  lr_filter->set_view_list_allowed( abap_false ).
  lr_filter->set_pdf_allowed( abap_false ).
ENDMETHOD.

May be its something to do with a fix as how you had pointed out earlier. Am on release 7 & level 13.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Susanne,

As how pointed out by Lekha you can achieve all of these features in ALV. The filtering & sorting functionalities are present by default within the ALV. You can programatically enable the complex filtering feature in ALV using the method set_filter_complex_allowed method. Try go through the mail that I have sent you.

DATA:
    lr_alv_usage       TYPE REF TO if_wd_component_usage,
    lr_if_controller   TYPE REF TO iwci_salv_wd_table,
    lr_config          TYPE REF TO cl_salv_wd_config_table,
    lr_filter          TYPE REF TO if_salv_wd_std_functions.

" Instantiate the ALV Component
  lr_alv_usage = wd_this->wd_cpuse_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_alv( ).
  lr_config        = lr_if_controller->get_model( ).

" Set the UI elements.
  lr_filter          ?= lr_config.

" Specify the setting for using ALV filter
  lr_filter->set_filter_complex_allowed( value = abap_true ).

Regards,

Uday

Former Member
0 Kudos

Hi,

Regarding the Scrollbar- Please check the number of the columns in your ALV table and also the width of table spanning accross all these columns.

Might be, in your table the columns matched with the table's width.

Please try to do this way in order to test the scrollbar-

use the method in the IF_SALV_WD_TABLE_SETTINGS of Model class and use the method-

FIRST_VISBILE_SCROLL_COL_COUNT and pass the number of columns to be visible for the intial

scrollbar. For ex: if your table has 10 columns and pass the first visible coumn count as 5. Then the scrollbar should appear now. I think this should work.

Regards,

Lekha