Application Development 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: 

how to disable 'set filter' in alv list display

Former Member
0 Kudos

Hi Friends,

I am working on alv report and I came across a requirement that I need to disable the 'set filter' to restrict the user from filtering records in output.

please help on this.

thanks in advance.

3 REPLIES 3

Former Member
0 Kudos

Hello,

Do like this.


FORM alv_pf_status_set_2 USING rt_extab TYPE slis_t_extab.

  DATA:
    lr_extab TYPE slis_extab.
    lr_extab-fcode = '&ILT'.
    APPEND lr_extab TO rt_extab.

  SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM          = G_F_PROGNAME
            I_CALLBACK_PF_STATUS_SET    = 'ALV_PF_STATUS_SET'
            I_CALLBACK_USER_COMMAND     = 'ALV_USER_COMMAND'
            I_CALLBACK_TOP_OF_PAGE      = 'ALV_TOP_OF_PAGE'
            I_CALLBACK_HTML_END_OF_LIST = 'ALV_END_OF_LIST'
            IS_LAYOUT                   = G_S_LAYOUT
            IS_PRINT                    = G_S_PRINT
            I_GRID_SETTINGS             = G_S_GRID_SET
            IT_FIELDCAT                 = G_T_FIELDCAT
            IT_SORT                     = G_T_SORT
            IS_VARIANT                  = G_R_VARIANT
            IT_EVENTS                   = G_T_EVENT
            I_SAVE                      = 'A'
            I_GRID_TITLE                = G_F_GRID_TITLE
       TABLES
            T_OUTTAB                    = G_T_ALVLIST
       EXCEPTIONS
            OTHERS                      = 1.

  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Vasanth

0 Kudos

HI

check these sample codes

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. "

Reward alll helpfull answers

Regards

Pavan

sharat_chandra
Active Participant
0 Kudos

Hi,

If you are using the ALV grid class CL_GUI_ALV_GRID then use the importing parameter IT_TOOLBAR_EXCLUDING to specify which buttons on the ALV grid you want to exclude. Please check attributes starting with MC_ in class CL_GUI_ALV_GRID for the values related to the functions on the toolbar.

Regards,

Sharat