‎2006 Aug 11 4:03 AM
How to display some thing at top of page while displaying some data using SET_TABLE_FOR_FIRST_DISPLAY.
I see its getting display when I go to the LIST display. But the requirement is to show at the very first grid display.
Could some one pls help me? Thanks.
‎2006 Aug 11 4:14 AM
‎2006 Aug 11 4:33 AM
you can define top_of_page event
CLASS-METHODS:
m002_handle_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid.
‎2006 Aug 11 4:39 AM
HI
good
YOU CAN USE TOP-OF-PAGE EVENT.
REPORT demo_list_page_heading NO STANDARD PAGE HEADING.
TOP-OF-PAGE.
WRITE: sy-title, 40 'Page', sy-pagno.
ULINE.
WRITE: / 'SAP AG', 29 'Walldorf, ',sy-datum,
/ 'Neurottstr. 16', / '69190 Walldorf/Baden'.
ULINE.
START-OF-SELECTION.
DO 5 TIMES.
WRITE / sy-index.
ENDDO.
thanks
mrutyun
‎2006 Aug 11 6:03 AM
Hi,
Declare something like this:
DATA: w_grid TYPE REF TO cl_gui_alv_grid.
DATA: w_custom_container
TYPE REF TO cl_gui_custom_container.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
Top of Page
CLASS-METHODS:
handle_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
Handle top of page
METHOD handle_top_of_page.
write:/ 'Report Name:', sy-repid,
'Date :', sy-datum,
'Time:', sy-uzeit,
'User:', sy-uname.
ENDMETHOD.
If you are using a custom container
CREATE OBJECT w_grid EXPORTING i_parent =
w_custom_container.
Create Event Receiver
CREATE OBJECT event_receiver.
Handle events
SET HANDLER event_receiver->handle_top_of_page
FOR w_grid.
Then use the
CALL METHOD wcl_grid->set_table_for_first_display
Regards
Subbu
‎2006 Aug 11 7:21 AM
I am exactly doing the same thing and using the top of page event to write.
The concern is that it is not being displyed on the screen at top.
Here is the code I am using:
Def:
HANDLE_END_OF_PAGE
FOR EVENT PRINT_END_OF_PAGE OF CL_GUI_ALV_GRID,
Imp:
METHOD HANDLE_TOP_OF_PAGE.
WRITE: / 'Event: PRINT_TOP_OF_PAGE'.
And the link with the grid:
SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR GRID1.
Grid1 is the ALV Gid.
‎2006 Aug 11 7:26 AM
Hi,
Check my Blog on Alv Top_of_page using Cl_gui_alv_grid class.
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
get back if you have any doubts.
Regards
vijay
‎2006 Aug 11 7:48 AM
Vijay....Thank you very much.
One question only....when ever u print from the GRID container....does the top of page is also printed on every page? Thanks
‎2006 Aug 11 8:01 AM
Hi,
it is only for Display purpose, it will not be printed . and in that case you have to use some other event.
you can use PRINT_TOP_OF_PAGE event for that purpose.
METHODS:
prit_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
METHOD print_top_of_page.
ADD 1 TO pagenum.
WRITE: / 'Trans. Code : ' , sy-tcode ,
/ 'Run Date : ' , sy-datum ,
/ 'User Name : ' , sy-uname ,
/ 'Page Number : ' , pagenum .
ULINE .
ENDMETHOD. "handle_top_of_page
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->print_top_of_page FOR g_grid.the print_top_f_page will trigger only when print is done. you can use this for your purpose.
Regards
vijay
Message was edited by: Vijay Babu Dudla