2009 Feb 09 7:31 AM
Hi experts,
We know that in ALV report we do have an option for filtering the data according to the input given to the filter for the selcted fields. I want to implelment this logic on a separate button other than 'filter' in ALV. Can any one tell me how this can be done?
Thanks.
Warm regards,
Harshad.
2009 Feb 09 8:02 AM
You can add a button for your functionality. To do that:
1- Create a Status GUI, and adjust the model to ALV.
2- Create a form to handle the commands. Implement here your functionality.
3- Pass to the ALV call the parameters i_callback_program, i_callback_pf_status_set, i_callback_user_command
For example:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'MY_STATUS' "Your status GUI
i_callback_user_command = 'MY_USER_COMMAND' "The form for the user command
....
...
FORM MY_USER_COMMAND USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
....
Implement here your code
...
ENDFORM
2009 Feb 09 8:02 AM
You can add a button for your functionality. To do that:
1- Create a Status GUI, and adjust the model to ALV.
2- Create a form to handle the commands. Implement here your functionality.
3- Pass to the ALV call the parameters i_callback_program, i_callback_pf_status_set, i_callback_user_command
For example:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'MY_STATUS' "Your status GUI
i_callback_user_command = 'MY_USER_COMMAND' "The form for the user command
....
...
FORM MY_USER_COMMAND USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
....
Implement here your code
...
ENDFORM
2009 Feb 09 8:25 AM
Hi,
Just set the user command code in the gui-status as in the standard button i.e. &ILT.
Regards.
2009 Feb 09 8:40 AM
Hi ,
You can try this FM -- ALV_GROUPLEVELS_WITH_FILTER .
Regards
Pinaki
2009 Feb 09 8:45 AM
Hi,
In the form user command u can do like this.. Supposse i want to filter based on storage location. adn the storage location internal table have all the storage locations.
DATA : lv_ref1 TYPE REF TO cl_gui_alv_grid,
lv_lines TYPE i.
DATA : lv_answer(1).
DATA: lit_selall TYPE lvc_t_moce,
ls_selall LIKE LINE OF lit_selall.
DATA lit_filter TYPE lvc_t_filt.
ls_selall-col_id = 1.
ls_selall-value = 'X'.
APPEND ls_selall TO lit_selall.
WHEN '&SALL'.
REFRESH lit_filter[].
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lv_ref1.
CALL METHOD lv_ref1->check_changed_data.
*Get the filter criteria
CALL METHOD lv_ref1->get_filter_criteria
IMPORTING
et_filter = lit_filter.
LOOP AT git_sloc ASSIGNING <lfs_sloc>.
CLEAR lv_sel.
LOOP AT lit_filter INTO lwa_filter.
CLEAR r_val.
REFRESH r_val[].
r_val-sign = lwa_filter-sign.
r_val-option = lwa_filter-option.
r_val-low = lwa_filter-low.
r_val-high = lwa_filter-high.
APPEND r_val.
CLEAR lv_field.
CONCATENATE '<lfs_sloc>-' lwa_filter-fieldname INTO lv_field.
ASSIGN (lv_field) TO <lfs_any>.
IF <lfs_any> IN r_val.
lv_sel = 'X'.
ELSE.
CLEAR lv_sel.
ENDIF.
IF <lfs_sloc>-check IS INITIAL.
<lfs_sloc>-check = lv_sel.
ENDIF.
ENDLOOP.
ENDLOOP.
rs_selfield-refresh = gc_x.
Regards,
Nagaraj
2009 Mar 12 6:11 AM