2006 Oct 17 7:50 PM
Hi,
I have a alv report and now I need to add 2 push buttons on the application tool bar for this report.
Can you please tell me how to proceed on this.
Thanks
Neelima.
Hi,
I have a alv report and now I need to add 2 push buttons on the application tool bar for this report.
Can you please tell me how to proceed on this.
Thanks
Neelima.
2006 Oct 17 7:54 PM
Hi,
if you are using functionmodule REUSE_ALV_GRID_DISPLAY, then you have to
I_CALLBACK_PF_STATUS_SET..
1. First create the ststus using set pf-status 'ZSTAT01' and then remove set pf-status statment.
2. assgine the created PF-status to g_formname_pf_status.
3. In the user-command, you can handle code.
DATA: g_formname_pf_status TYPE slis_formname.
g_formname_pf_status = 'ZSTAT01',
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = g_formname_pf_status
..............
.................
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = output_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
Thanks,
Ramakrishna
2006 Oct 17 8:30 PM
hi,
set pf-status 'TEST'.
double clcik on test then u will forwarded to menu painter. expand the application toolbar and provide ur buttons and ur function codes for that.. u can choose icons for buttons and text for icons to display. provide function keys.. save and activate.
provide the pf-status to ur alv grid control.
Regards
2006 Oct 17 10:47 PM
Thank you Rama Krishna and Srinu.
I mentioned the statement set pf-status 'zsele' in my program and created two buttons select all, deselect all. But these buttons are comming on the select screen, not on the output screen.
Can you please help me resolve this.
Thanks
Neelima.
2006 Oct 17 11:33 PM
Hi,
Follow the below steps to add your own buttons to ALV Grid Reort.
1. Copy the standard status STANDARD from program SAPLSALV to your program.
YOu can do this from transaction SE41. Now add your buttons to this status.
2. Now let us say the copied status is STAT001.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_bypassing_buffer = gs_test-bypassing_buffer
i_buffer_active = gs_test-buffer_active
i_callback_program = g_repid
i_callback_pf_status_set = 'STAT001'
i_callback_user_command = 'F01_ALV_EVENT_USER_COMMAND'
is_layout = ls_layo
it_fieldcat = lt_fcat
i_default = gs_test-vari_default
i_save = gs_test-vari_save
is_variant = ls_vari
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = gt_outtab
exceptions
program_error = 1
others = 2.
Now write code in the USER_COMMAND for the new buttons.
Thanks,
Ramakrishna
2006 Oct 18 10:19 PM
Hi Rama krishna,
I tried it. Now I am getting Select all and Deselect all buttons, but I am not able to get my third button Remove. How should I get it and it is taking lot of time to get the output screen.
I am sending my include, can you please check, if I am doing any thing wrong.
Also I am getting lot of other buttons with my include. How to get rid of them.
Thank you
Neelima.
data:
g_variant like disvariant. "variants
type-pools: slis. "Global types
data: s_alv_layout_cat type slis_layout_alv.
data: s_alv_print_cat type slis_print_alv.
* ALV field catalog
data: it_alv_field_cat type slis_fieldcat_alv occurs 0 with header line,
S_FIELDCATALOG type slis_fieldcat_alv occurs 0 with header line,
i_fieldcat type slis_fieldcat_alv occurs 0 with header line,
w_fieldcat like line of i_fieldcat. "ALV FieldCat WorkArea
* ALV sort catalog
data: it_alv_sort_cat type slis_sortinfo_alv occurs 0 with header line.
* ALV event catalog
data: it_alv_event_cat type slis_alv_event occurs 0 with header line.
data: t_list_top_of_page type slis_t_listheader.
DATA: g_formname_pf_status TYPE slis_formname.
form sub_alv_routines.
* Populate the layout catalog for alv
perform alv_layout.
* Populate the event catalog for alv
perform alv_events.
* Populate the print catalog for alv
perform alv_print.
endform. "sub_alv_routines
g_formname_pf_status = 'ZSTAT01'.
form sub_call_alv_grid tables lt_output.
* Call ALV display
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-cprog
i_callback_pf_status_set = g_formname_pf_status
is_layout = s_alv_layout_cat
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_alv_field_cat[]
* it_sort = it_alv_sort_cat[]
i_save = 'A'
is_variant = g_variant
it_events = it_alv_event_cat[]
is_print = s_alv_print_cat
i_grid_title = text-t01
tables
t_outtab = lt_output
exceptions
program_error = 1
others = 2.
* if sy-subrc <> 0.
* message e048. "Error executing func. module REUSE_ALV_LIST_DISPLAY
* endif.
endform. " sub_call_alv_grid
form alv_layout.
* Enable striped output display if user wants
s_alv_layout_cat-zebra = 'X'.
* Optimize column width if user wants
s_alv_layout_cat-colwidth_optimize = 'X'.
s_alv_layout_cat-box_fieldname = 'CHECK'.
s_alv_layout_cat-no_input = 'X'.
* if p_lines = 'X'.
* s_alv_layout_cat-no_vline = ' '.
* else.
* s_alv_layout_cat-no_vline = 'X'.
* endif.
s_alv_layout_cat-no_colhead = ' '.
s_alv_layout_cat-lights_condense = 'X'.
s_alv_layout_cat-info_fieldname = 'ALV_COLOR'.
s_alv_layout_cat-confirmation_prompt = 'X'.
s_alv_layout_cat-detail_popup = 'X'.
s_alv_layout_cat-detail_initial_lines = 'X'.
endform. " alv_layout
form alv_events.
* Declare event catalog for page headers
clear it_alv_event_cat.
it_alv_event_cat-name = 'TOP_OF_PAGE'.
it_alv_event_cat-form = 'TOP_OF_PAGE'.
append it_alv_event_cat.
* Declare event catalog for report footers
clear it_alv_event_cat.
it_alv_event_cat-name = 'END_OF_LIST'.
it_alv_event_cat-form = 'END_OF_LIST'.
* append it_alv_event_cat.
endform. " alv_events
form alv_print.
* Declare print catalog for statistics page
s_alv_print_cat-no_print_listinfos = 'X'.
endform. " alv_print
form alv_build_fieldcat using lt_output l_repid.
*DATA: S_FIELDCATALOG type SLIS_T_FIELDCAT_ALV occurs 0.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = l_repid
i_internal_tabname = lt_output
* I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = l_repid
changing
ct_fieldcat = it_alv_field_cat[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0. "something went wrong...
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
s_fieldcatalog-checkbox = 'X'.
s_fieldcatalog-edit = 'X'.
endform. " ALV_BUILD_FIELDCAT