2007 May 25 1:35 PM
Hi Experts,
Can you please provide me code for displaying the Page numbers in Top of page in format ( Page 1 of 10) in the Report output. My report output page size is (LINE-COUNT 65 LINE-SIZE 255).
Thanks in advance.
Regards,
Ram
2007 May 25 1:38 PM
Hello,
Check this sample report:
Here is a sample program which will help. The idea here, is that you need to write the entire list first, then go back and put the number of pages.
report zrich_0004
line-size 80
line-count 65
no standard page heading.
data: imara type table of mara with header line.
selection-screen begin of block b1 with frame title text-001 .
parameters: p_check type c.
selection-screen end of block b1.
start-of-selection.
perform get_data.
perform write_report.
top-of-page.
perform top_of_page.
************************************************************************
* FORM GET_DATA
************************************************************************
form get_data.
select * into corresponding fields of table imara
from mara up to 300 rows.
endform.
************************************************************************
* FORM WRITE_REPORT
************************************************************************
form write_report.
data: xpage(4) type c.
loop at imara.
write:/ imara-matnr.
endloop.
write sy-pagno to xpage left-justified.
do sy-pagno times.
read line 1 of page sy-index.
replace '****' with xpage into sy-lisel.
modify current line.
enddo.
endform.
************************************************************************
* Form top_of_page
************************************************************************
form top_of_page.
write:/32 'Test Program',
at 62 'Page:', at 67 sy-pagno, 'of', '****'.
endform.
REgards,
Vasanth
2007 May 25 1:38 PM
Hello,
Check this sample report:
Here is a sample program which will help. The idea here, is that you need to write the entire list first, then go back and put the number of pages.
report zrich_0004
line-size 80
line-count 65
no standard page heading.
data: imara type table of mara with header line.
selection-screen begin of block b1 with frame title text-001 .
parameters: p_check type c.
selection-screen end of block b1.
start-of-selection.
perform get_data.
perform write_report.
top-of-page.
perform top_of_page.
************************************************************************
* FORM GET_DATA
************************************************************************
form get_data.
select * into corresponding fields of table imara
from mara up to 300 rows.
endform.
************************************************************************
* FORM WRITE_REPORT
************************************************************************
form write_report.
data: xpage(4) type c.
loop at imara.
write:/ imara-matnr.
endloop.
write sy-pagno to xpage left-justified.
do sy-pagno times.
read line 1 of page sy-index.
replace '****' with xpage into sy-lisel.
modify current line.
enddo.
endform.
************************************************************************
* Form top_of_page
************************************************************************
form top_of_page.
write:/32 'Test Program',
at 62 'Page:', at 67 sy-pagno, 'of', '****'.
endform.
REgards,
Vasanth
2007 May 25 1:38 PM
Hi
<b>It will be calculated based on the Linecount (no of lines per page you define along with report) and the total number of data lines in the internal table or db table(sy-dbcnt - to know this describe internal table lines ) .
Do like this
data: n type p, m type i.
n = CEIL( sy-dbcnt / ( sy-linct - 3 ) ).
m = n.
m will give the total number of pages of the list.
now write
Write: / SY-PAGNO 'of' m.</b>
Reward points if useful
Regards
Anji
2007 May 25 1:39 PM
hi,
chk this link,
How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
With Regards,
S.Barani
2007 May 25 1:39 PM
Hello,
Check this code
data:it_mara type table of mara with header line.
parameters: p_check type c.
start-of-selection.
perform get_data.
perform write_report.
top-of-page.
perform top_of_page.
form get_data.
select * into corresponding fields of table it_mara
from mara up to 300 rows.
endform.
form write_report.
data: page(4) type c.
loop at it_mara.
write:/ it_mara-matnr.
endloop.
write sy-pagno to page left-justified.
do sy-pagno times.
read line 1 of page sy-index.
replace '****' with page into sy-lisel.
modify current line.
enddo.
endform.
form top_of_page.
write:/32 'Test Program',
at 62 'Page:', at 67 sy-pagno, 'of', '****'.
endform.
Regards,
Deepu.K