on 07-06-2007 6:02 AM
hi all,
i want to put page number in alv report in my form top_of_page , how can i do that
thanks
himanshu sharma
Hi,
Please see the following program, this uses the ALV list display which is what you get if you were to print from the grid anyway.
report zrich_0001
no standard page heading.
Global ALV Data Declarations
type-pools slis.
data: isbook type table of sbook.
Miscellanous Data Declarations
data: fieldcat type slis_t_fieldcat_alv,
events type slis_t_event,
list_top_of_page type slis_t_listheader,
top_of_page type slis_formname value 'TOP_OF_PAGE'.
start-of-selection.
perform eventtab_build using events[].
select * into table isbook from sbook.
perform call_alv.
************************************************************************
CALL_ALV
************************************************************************
form call_alv.
data: repid type sy-repid.
repid = sy-repid.
Call ABAP List Viewer (ALV)
You can do the same with the GRID as well
The page number will come when printed in the spool.
call function 'REUSE_ALV_LIST_DISPLAY'
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'SBOOK'
i_callback_program = repid
it_events = events[]
tables
t_outtab = isbook.
endform.
************************************************************************
EVENTTAB_BUILD
************************************************************************
form eventtab_build using events type slis_t_event.
Registration of events to happen during list display
data: tmp_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = events.
read table events with key name = slis_ev_top_of_page
into tmp_event.
if sy-subrc = 0.
move top_of_page to tmp_event-form.
append tmp_event to events.
endif.
endform.
************************************************************************
COMMENT_BUILD
************************************************************************
form comment_build using list_top_of_page type
slis_t_listheader.
data: tmp_line type slis_listheader.
data: pagno(5) type c.
clear tmp_line. refresh list_top_of_page.
pagno = sy-pagno.
clear tmp_line.
tmp_line-typ = 'H'.
concatenate 'Page:' pagno into tmp_line-info
separated by space.
append tmp_line to list_top_of_page.
endform.
************************************************************************
TOP_OF_PAGE
************************************************************************
form top_of_page.
perform comment_build using list_top_of_page[].
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = list_top_of_page.
endform.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hii ,
try like this Just count how many lines are fitted into one page. Then divide total no items of the internal table by line which are fitted in one page. U will get
total no of pages.
After that total page and current can be showed on alv by using top-of-page event
regards
reena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.