Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV: cannot filter multiple columns at a time

Former Member
0 Likes
1,372

Hi,

I'm trying to fix a problem in a report that uses ALV grid: when I try to filter the grid content by choosing a multi-column criteria, I get prompted only to enter the first column selection criteria. That is, I multi-select 2 or more columns, right click, then Set Filter...; I get the selection only for the first selected column. I know this is a built-in feature of ALV grid, is there a parameter I'm missing when I build the grid?

Thanks a lot,

Dinu

Here are some code snippets:

....

FORM output_report.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZRRRMPROJSTAT'

is_layout = gs_layout

it_fieldcat = gt_fieldcat

it_sort = gt_sort

i_save = 'A'

it_events = gt_events

TABLES

t_outtab = i_project

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. " output_report

..........

....................

FORM build_fieldcat.

DATA: s_fieldcat TYPE slis_fieldcat_alv.

DATA: l_col_count like s_fieldcat-col_pos.

l_col_count = 1.

CLEAR s_fieldcat.

s_fieldcat-col_pos = l_col_count.

l_col_count = l_col_count + 1.

s_fieldcat-tabname = i_project.

s_fieldcat-fieldname = 'PSPID'.

s_fieldcat-datatype = 'CHAR'.

s_fieldcat-outputlen = '10'.

s_fieldcat-seltext_l = 'Project Number'.

s_fieldcat-seltext_m = 'Project Number'.

s_fieldcat-seltext_s = 'Project Number'.

s_fieldcat-key = 'X'.

s_fieldcat-fix_column = 'X'.

s_fieldcat-just = 'C'.

s_fieldcat-no_zero = 'X'.

APPEND s_fieldcat TO gt_fieldcat.

  • and so on....

ENDFORM

....

FORM sort_layout.

DATA: ls_sort TYPE slis_sortinfo_alv.

REFRESH gt_sort.

CLEAR ls_sort.

ls_sort-spos = '1'.

ls_sort-tabname = 'i_project'.

ls_sort-fieldname = 'PSPID'.

APPEND ls_sort TO gt_sort.

CLEAR ls_sort.

ls_sort-spos = '2'.

ls_sort-tabname = 'i_project'.

ls_sort-fieldname = 'POSID'.

APPEND ls_sort TO gt_sort.

ENDFORM. " sort_layout

.........

....

FORM build_layout.

CLEAR gs_layout.

  • gs_layout-totals_before_items = 'X'.

gs_layout-zebra = 'X'.

gs_layout-numc_sum = 'X'.

gs_layout-get_selinfos = 'X'.

gs_layout-box_tabname = 'X'.

gs_layout-info_fieldname = 'COLOR'.

ENDFORM. "

.................

Hi,

I'm trying to fix a problem in a report that uses ALV grid: when I try to filter the grid content by choosing a multi-column criteria, I get prompted only to enter the first column selection criteria. That is, I multi-select 2 or more columns, right click, then Set Filter...; I get the selection only for the first selected column. I know this is a built-in feature of ALV grid, is there a parameter I'm missing when I build the grid?

Thanks a lot,

Dinu

Here are some code snippets:

....

FORM output_report.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZRRRMPROJSTAT'

is_layout = gs_layout

it_fieldcat = gt_fieldcat

it_sort = gt_sort

i_save = 'A'

it_events = gt_events

TABLES

t_outtab = i_project

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. " output_report

..........

....................

FORM build_fieldcat.

DATA: s_fieldcat TYPE slis_fieldcat_alv.

DATA: l_col_count like s_fieldcat-col_pos.

l_col_count = 1.

CLEAR s_fieldcat.

s_fieldcat-col_pos = l_col_count.

l_col_count = l_col_count + 1.

s_fieldcat-tabname = i_project.

s_fieldcat-fieldname = 'PSPID'.

s_fieldcat-datatype = 'CHAR'.

s_fieldcat-outputlen = '10'.

s_fieldcat-seltext_l = 'Project Number'.

s_fieldcat-seltext_m = 'Project Number'.

s_fieldcat-seltext_s = 'Project Number'.

s_fieldcat-key = 'X'.

s_fieldcat-fix_column = 'X'.

s_fieldcat-just = 'C'.

s_fieldcat-no_zero = 'X'.

APPEND s_fieldcat TO gt_fieldcat.

  • and so on....

ENDFORM

....

FORM sort_layout.

DATA: ls_sort TYPE slis_sortinfo_alv.

REFRESH gt_sort.

CLEAR ls_sort.

ls_sort-spos = '1'.

ls_sort-tabname = 'i_project'.

ls_sort-fieldname = 'PSPID'.

APPEND ls_sort TO gt_sort.

CLEAR ls_sort.

ls_sort-spos = '2'.

ls_sort-tabname = 'i_project'.

ls_sort-fieldname = 'POSID'.

APPEND ls_sort TO gt_sort.

ENDFORM. " sort_layout

.........

....

FORM build_layout.

CLEAR gs_layout.

  • gs_layout-totals_before_items = 'X'.

gs_layout-zebra = 'X'.

gs_layout-numc_sum = 'X'.

gs_layout-get_selinfos = 'X'.

gs_layout-box_tabname = 'X'.

gs_layout-info_fieldname = 'COLOR'.

ENDFORM. "

.................

4 REPLIES 4
Read only

Former Member
0 Likes
827

Hi,

I think there is no prob with ALV, U follow steps as:

click on alv Set filter button.

then transfer column names to filter field list,

on same screen filter button is there click it,

now it will ask for both filter criteria.

I am sure it will do, Award if it helps

Jogdand M B

Read only

0 Likes
827

Unfortunately it doesn't work by either opening Set filter dialog or Right-click on selected columns; what's annoying is that other similar reports using ALV work fine, but this one doesn't.

Thanks anyway Jogdand.

Read only

Former Member
0 Likes
827

IT_filter is missing.....before calling the set table for first display....call method cl_gui_alv_grid=>get_filter_criteria importing gt_filter.................this should work fine...

Thanks,

Gangadhar.

*****Reward for helpful answers

Read only

Former Member
0 Likes
827

Found the problem myself: instead of

.....

FORM build_fieldcat.

...

s_fieldcat-tabname = i_project.

..

it should be:

.....

FORM build_fieldcat.

...

s_fieldcat-tabname = 'i_project'.

.........

Stupid !@#!@ little mistakes like this can ruin your day sometimes...