How to get ALV filter work for lower case characters

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
1,925
Tepki puanı
7
Puanları
6
When you are using ALV screen with class CL_SALV_TABLE or CL_GUI_ALV_GRID.

The filter is working for some column but not working for the others.

After changing the content for this column to uppercase, the filter works again.

Solution:

I searched on the internet and found that most solutions point at field catalog.

When I try this in my own case, it did not work.

Default ALV screen is designed for uppercase. When you are using “Hump Type” which including

lower case and upper case letters. Under default column settings, the filter will turn

the content you filtered to upper case automatically.

What you should do?

You should enable the lowercase mode for the specific column.

How to enable this?

When you get your column for example lo_column.

You just need to call its set lowercase function.



*define the column
DATA lo_column TYPE REF TO cl_salv_column_table.
DATA lo_columns TYPE REF TO cl_salv_columns_table.
DATA lt_column_ref TYPE salv_t_column_ref.
DATA ls_column_ref TYPE salv_s_column_ref.
DATA go_salv_table TYPE REF TO cl_salv_table .
DATA lt_column_ref TYPE salv_t_column_ref.
DATA ls_column_ref TYPE salv_s_column_ref.

*get your ALV instance


cl_salv_table=>factory( IMPORTING r_salv_table = go_salv_table
CHANGING t_table = "your table here
).

*get the column
lo_columns = go_salv_table->get_columns( ).
lt_column_ref = lo_columns->get( ).

* set lowwer case
LOOP AT lt_column_ref INTO ls_column_ref.
lo_column ?= ls_column_ref-r_column.
CASE ls_column_ref-columnname.
WHEN 'XXXX'.
lo_column->set_lowercase( value = if_salv_c_bool_sap=>true ).
ENDCASE.
ENDLOOP.

This is how I solve this problem, Hope this will help you!

Okumaya devam et...
 
Üst