cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ALV disable column sort for specific column

Former Member
0 Kudos

Hi,

I have the above mentioned problem. The Coding I use is:

DATA: lr_field_settings TYPE REF TO if_salv_wd_field_settings,

lt_fields TYPE SALV_WD_T_FIELD_REF.

FIELD-SYMBOLS: <fs_field> LIKE LINE OF lt_fields.

lr_field_settings ?= lr_config.

lt_fields = lr_field_settings->get_fields( ).

READ TABLE lt_fields ASSIGNING <fs_field> WITH KEY fieldname = 'ANSPRECH_DETAILS'.

IF sy-subrc EQ 0.

<fs_field>-r_field->if_salv_wd_sort~set_sort_allowed( abap_false ).

<fs_field>-r_field->if_salv_wd_sort~set_grouping_allowed( abap_false ).

ENDIF.

When debugging I can see that the object attributes for sort_allowed and grouping_allowed are changed from 'X' to ' '

but the running application still allows sorting and grouping for the column 'ANSPRECH_DETAILS'.

So what did I forget or what is my mistake ????

Thx for your help.

Dino Dini

Accepted Solutions (0)

Answers (1)

Answers (1)

Lukas_Weigelt
Active Contributor
0 Kudos

You might want to try using some methods from CL_SALV_WD_CONFIG_TABLE.

Former Member
0 Kudos

Perhalps I should have mentioned using cl_salv_wd_config_table for getting the lr_config reference:

DATA: lr_config TYPE REF TO cl_salv_wd_config_table.

I don't see any methods of this class where I can set the sorting behavior for only one specific column. Following the integrated SAP class description you have to use objects of type lr_field. You get this lr_field ref by using the lr_config ref to get it for a specific field (column). But something seems to be missing. Perhalps I have to use something like a refresh method at the end (but I tried it already and it didnt solve the problem).

DATA:

lr_if_controller TYPE REF TO iwci_salv_wd_table,

lv_refresh_in TYPE if_salv_wd_table=>s_type_param_refresh_in.

lr_if_controller->refresh( lv_refresh_in ).

(All the above coding is within the wddomodifyview Method of the relevant view)

Thx Dino Dini

Edited by: dinodini on Sep 28, 2011 6:21 PM

ChandraMahajan
Active Contributor
0 Kudos

Hi,

try to put the code in WDDOINIT instead of WDDOMODIFY.

Thanks,

Chandra

Former Member
0 Kudos

Just tried to put the coding in wddoinit but its the same problem when using wddoinit. So same problem in wddoinit.

Thx Dino Dini

Edited by: dinodini on Sep 29, 2011 10:13 AM

Former Member
0 Kudos

I got the similar requirement and I tried to do the below way.. it worked for me..

 

DATA: lr_field_settings TYPE REF TO if_salv_wd_field_settings.
DATA: lr_field TYPE REF TO cl_salv_wd_field.

lr_field_settings ?= lr_table
.

lr_field
= lr_field_settings->get_field( 'MATNR' ).
lr_field
->IF_SALV_WD_SORT~SET_SORT_ALLOWED( abap_false

).

you can observe in the below image that sort option is not enabled for MATNR in the ALV.