Skip to Content
avatar image
Former Member

Why my alv table doesn't has standard sort functionality ?

Hi,

I just create simple webdynpro with standard alv table.

lr_node = wd_context->get_child_node('STATUSLOGS').

SELECT * FROM zstatus_log INTO CORRESPONDING FIELDS OF TABLE lt_statuslog
WHERE file_name IN <fs_file_name>.

lr_node->bind_table( lt_statuslog ).

why the standard column sort functionality doesn't work. I cannot click on the header name ? it seems like readonly.

Please advise what is the possibility cause the problem.

Thank You and Regards

Fernand

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 22, 2010 at 09:18 AM

    Hi,

    Thank you for your response.

    After i did some investigation, actually the sort functionality is thee but i need to click setting and choose which column that i want to put in into sort column. It is not come by default.

    is that any way to set the sorted column from program so i no need to edit the setting everytime open the screen.

    Thank You and Best Regards

    Fernand Lesmana

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      HI,

      Not sure if i understood correctly!

      If you want to sort a column in alv, you can do that as mentioned below.

      * Sort rows by seatsocc descending
        DATA: lr_field TYPE REF TO cl_salv_wd_field.
        lr_field = lv_value->if_salv_wd_field_settings~get_field( 'SEATSOCC' ). "lv_value is configuration model
        lr_field->if_salv_wd_sort~create_sort_rule( sort_order = if_salv_wd_c_sort=>sort_order_descending ). "for sorting in ascending order change the sort order to  if_salv_wd_c_sort=>sort_order_ascending 
      

      Hope this helps!

      Regards,

      Srilatha

  • avatar image
    Former Member
    Jun 22, 2010 at 08:17 AM

    hi,

    I guess by default, column sort should be possible on alv table unless you had explicitly disabled sorting.

    try using the following code to enable the sort functionality:

    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( ).
      ENDIF.
    
      DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      lo_interfacecontroller =   wd_this->wd_cpifc_alv_usage( ).
    
      DATA lv_value TYPE REF TO cl_salv_wd_config_table.
      lv_value = lo_interfacecontroller->get_model(
      ).
    lv_value->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_HEADERCLICK_ALLOWED( value = abap_true ).( 

    Hope this helps!

    Regards,

    Srilatha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 08:20 AM

    Hello , actually by default it will allow the sort functionality .

    you manualy activate the sort function by place this code in Do init method

    data: lr_standard_functions type ref to if_salv_wd_std_functions,
    r_table TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
    
    lr_standard_functions ?= wd_this->r_table. 
    lr_standard_functions->set_sort_headerclick_allowed(  abap_true ).

    Regards

    Chinnaiya P

    Add comment
    10|10000 characters needed characters exceeded