Skip to Content
0
Former Member
Jul 01, 2009 at 09:27 AM

Problem with ALV filter button for field defined by character

745 Views

Dear all experts,

Pls help me to solve a problem regarding ALV filter button. I have developed a report regarding staff move in and out of the company. The report output is the ALV layout so that sorting and filtering will be easy to perform.

I have used function module for the ALV.

The problem here is when i use filter button for any of ALV columns which defined by character type, 'c', e.g 'Employee name'

the outcome is no records has been displayed eventhough i select from the values given for the filter criteria.

The filter button for columns defined by 'numc' works fine. Did i miss anything in the code??

Below is some codes for reference.

--


for ALV declaration begin--

  • Internal tables

DATA: it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,

it_event TYPE slis_t_event,

it_list_top_of_page TYPE slis_t_listheader, " FOR HEADER

it_sort TYPE slis_t_sortinfo_alv.

DATA: s_print TYPE slis_print_alv,

str_sort TYPE slis_sortinfo_alv.

  • Working variables

DATA: wa_layout TYPE slis_layout_alv,

wa_repid LIKE sy-repid,

wa_event TYPE slis_alv_event.

________________________________________________________________

FORM build_summary_fieldcat.

wa_repid = sy-repid.

PERFORM fieldcat USING :

'PERNR' 'ta_staff' 'Employee No.' '' '' '' 'NUMC',

'NAME' 'ta_staff' 'Employee Name' '' '' '' 'CHAR',

'POSITION' 'ta_staff' 'Position' '' '' '' 'CHAR',

'WERKS' 'ta_staff' 'Persn. Area' '' '' '' 'CHAR',

'AREATXT' 'ta_staff' 'Persn. Area Name' '' '' '' 'CHAR',

'BTRTL' 'ta_staff' 'Persn. SubArea' '' '' '' 'CHAR',

'BTEXT' 'ta_staff' 'Persn. SubArea Name' '' '' '' 'CHAR',

'BTWERKS' 'ta_staff' 'P.Area(Before Transfer)' '' '' '' 'CHAR',

'BTNAME' 'ta_staff' 'P.Area Name(Before Transfer)' '' '' '' 'CHAR',

'BTBTRTL' 'ta_staff' 'P.SubArea(Before Transfer)' '' '' '' 'CHAR',

'BTBTEXT' 'ta_staff' 'P.SubArea Name(Before Transfer)' '' '' '' 'CHAR',

'ORGEH' 'ta_staff' 'Org. Unit' '' '' '' 'CHAR',

'ORGTXT' 'ta_staff' 'Org. Unit Name' '' '' '' 'CHAR',

'TRFGR' 'ta_staff' 'Grade' '' '' '' 'CHAR',

'EVENT' 'ta_staff' 'Action' '' '' '' 'CHAR',

'BEGDA' 'ta_staff' 'Action Date' '' '' '' 'DATS',

'REASON' 'ta_staff' 'Reason of Action' '' '' '' 'CHAR'.

ENDFORM. " BUILD_SUMMARY_FIELDCAT

FORM fieldcat USING p_fieldname TYPE any

p_tabname TYPE any

p_seltext_l TYPE any

p_do_sum TYPE any

p_just TYPE any

p_outputlen TYPE any

p_datatype TYPE any.

DATA: wa_fieldcat TYPE slis_fieldcat_alv.

  • Populate table for fieldcat

wa_fieldcat-fieldname = p_fieldname.

wa_fieldcat-tabname = p_tabname.

wa_fieldcat-seltext_l = p_seltext_l.

wa_fieldcat-do_sum = p_do_sum.

wa_fieldcat-just = p_just.

wa_fieldcat-outputlen = p_outputlen.

wa_fieldcat-datatype = p_datatype.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

________________________________________________________________________________

FORM build_layout .

  • optimize width of each column

wa_layout-colwidth_optimize = 'X'.

ENDFORM. " BUILD_LAYOUT

__________________________________________________________________________________

FORM sort_alv USING f_fieldname TYPE c

f_up TYPE c

f_group TYPE c

f_subtot TYPE c.

str_sort-fieldname = f_fieldname.

str_sort-up = f_up.

str_sort-group = f_group.

str_sort-subtot = f_subtot.

APPEND str_sort TO it_sort.

CLEAR str_sort.

____________________________________________________________________________________

FORM display_summ_alv.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_background_id = 'ALV_BACKGROUND'

i_callback_program = wa_repid

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = wa_layout

it_fieldcat = it_fieldcat

it_sort = it_sort

i_save = 'A'

is_print = s_print

TABLES

t_outtab = ta_staff.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Thanks alot.

Edited by: safarin on Jul 1, 2009 11:29 AM