03-21-2011 1:52 PM
Hi All,
i need to create a icon in alv toolbar.
But i have not created any 'Z' program.
i have created one function module, through that function module i am displaying the ALV grid.
when i am copying the standard pf-status it is asking for program name. but i am using only the function module.
pls help me on this for creating the icon in alv toolbar.
thanks in advance.
03-21-2011 2:02 PM
Here you go :
DATA: ls_bar TYPE stb_button.
CLEAR ls_bar.
*add user button to the ALV toolbar
MOVE 'TRANS' TO ls_bar-function.
MOVE text-004 TO ls_bar-quickinfo.
MOVE icon_transport TO ls_bar-icon.
MOVE text-005 TO ls_bar-text.
CLEAR ls_bar-disabled.
APPEND ls_bar TO e_object->mt_toolbar.
03-21-2011 2:23 PM
03-21-2011 2:31 PM
hi sandeep,
how to declare e_object->mt_toolbar..
and how to pass this variable in alv..
03-21-2011 2:47 PM
03-21-2011 5:42 PM
Text-004 /005 can be anything as per your requirement.
e_object is an instance of cl_gui_alv_grid and using one of the attributes .
03-21-2011 2:46 PM
Hello Aishvarya,
The program name that you copy to is derived by concatenating SAPL + function group name that the function module resides in. For example, if your function group name is zfunc_group, then the corresponding program name is SAPLZfunc_group.
03-21-2011 4:17 PM
Hello Aishvarya,
Perhaps the code below will help guide you along.
FUNCTION z_alv_screen .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" CHANGING
*" REFERENCE(ITAB) TYPE ZSFLIGHT_TT
*"----------------------------------------------------------------------
DATA: gr_table TYPE REF TO cl_salv_table.
*
* ALV
*... Create Instance
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = itab[].
CATCH cx_salv_msg.
ENDTRY.
gr_table->set_screen_status(
pfstatus = 'SALV_STANDARD'
report = 'SAPLZRAE'
set_functions = gr_table->c_functions_all ).
*... Display Table
gr_table->display( ).
ENDFUNCTION.
Edited by: Rae Ellen Woytowiez on Mar 21, 2011 5:17 PM