2005 Sep 05 9:02 AM
Hi Everyone,
I have 4-5 grids on my screen and a common custom toolbar for all of the grids. The toolbar has buttons like print, find, details, export etc. Based on the focus on which grid I will have to implement the above toolbar functionality.
After figuring out on which grid the focus was present, when the user clicked on the toolbar button. I would like to know how to implement print, find, details, export functions. Are there any grid related function modules which I can call to implement these functions.
Sample codes will be highly appreciated.
Thanks in advance,
Prabhakar.
2005 Sep 05 9:13 AM
Hi Prabhakaran,
Standard SAP toolbar has the Print/Find buttons that will work for you.
Print, Find are functions that are handled by the standard SAP, if you dont handle it yourself.
Did u try giving it a func code and letting SAP handle it ?
Rgds,
Prashanth.
2005 Sep 05 9:13 AM
Hi Prabhakaran,
Standard SAP toolbar has the Print/Find buttons that will work for you.
Print, Find are functions that are handled by the standard SAP, if you dont handle it yourself.
Did u try giving it a func code and letting SAP handle it ?
Rgds,
Prashanth.
2005 Sep 05 9:21 AM
Hi Prashanth,
I tried giving a function code but it doesn't work. It gives an error saying "this function is not possible". Since the focus is on a ALV grid, SAP doesn't know how to print it. Do u have any sample code.
Thanks,
Prabhakar.
2005 Sep 05 10:07 AM
Hi,
Here is a Sample Code,
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_SORT = GT_SORT[]
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
Also Check this link,
http://www.sap-basis-abap.com/sapalv.htm
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_events.htm
Hope it helps u.
Thanks&Regards,
Ruthra.R
2005 Sep 05 10:13 AM
you need to build a commn toolbar using class CL_GUI_TOOLBAR and from these button you can trigger the events of the grids.
Regards
Raja
2005 Sep 06 4:15 AM
Hi All,
I'm using object oriented implementation for alv grid. I want to print the contents of the grid as a list. Are there any methods to call the implement the print function. Here is the sample of how my code looks like,
create object alv_container
exporting container_name = 'ALV_CONTAINER'.
create Event Receiver
create object event_receiver.
create object alv_grid
exporting i_parent = alv_container.
gs_layout-grid_title = 'Flights'.
gs_layout-keyhot = 'X'.
clear fieldcat. refresh: fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Carriage Number'.
ls_fcat-coltext = 'Carriage Number'.
ls_fcat-fieldname = 'CARRID'.
ls_fcat-ref_table = 'IALV'.
ls_fcat-hotspot = 'X'.
ls_fcat-outputlen = '10'.
ls_fcat-col_pos = 1.
append ls_fcat to fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Flight Description'.
ls_fcat-coltext = 'Flight Description'.
ls_fcat-fieldname = 'CONNID'.
ls_fcat-ref_table = 'IALV'.
ls_fcat-hotspot = 'X'.
ls_fcat-outputlen = '20'.
ls_fcat-col_pos = 2.
append ls_fcat to fieldcat.
call method alv_grid->set_table_for_first_display
exporting
is_layout = gs_layout
changing
it_outtab = ialv[]
it_fieldcatalog = fieldcat[].
handler for ALV grid
set handler event_receiver->handle_hotspot_click for alv_grid.
Thanks,
Prabhakar.
2005 Sep 06 6:07 AM
check this program to find how you can manage the grid toolbar button click event from outside.
BCALV_TEST_GRID_TOOLBAR
Regards
Raja
2005 Sep 05 10:44 AM
2011 Jan 10 7:25 PM
Hi,
We can use ABAP ALV LIST and GRID function modules to display Normal LIST and Hiearchical LISTS
REUSE_ALV_LIST_DISPLAY
REUSE_ALV_HIERARCHICAL_LIST_DISPLAY
REUSE_ALV_GRID_DISPLAY
TYPE SLIS_T_FIEDLCAT_ALV
These are the function modules are used
If you want code on alv grid functions then follow this site
http://sap.niraj.tripod.com/id66.html
it will helpful for you.
2011 Jan 10 8:37 PM
Hi Prabhakaran,
clicking on your common custom toolbar will set the focus on this toolbar. You will not know where it was before, at least I do not know such a thing as focus history.
By the way, how do you display the four grids and how do you display them without toolbar?
Regards,
Clemens
2011 Jan 10 8:52 PM