Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

for displaying page numbers at the bottom of page

Former Member
0 Kudos

Hi all,

i have written the following code for dispplaying the page number at the top. Now i want to displkay the pagenumber at the bottm of each page.

instead of top-of-page i have mentioned end-of-page.but in the output i am getting like : 1 / -


.

what changes i have to do for my code to display the page numbers at the bottom pf the each page.

Note: i am displayig page numbers as 1 / 10, 2 / 10 etc. format.

REPORT ZDEMO_EOF NO STANDARD PAGE HEADING LINE-SIZE 100 line-count 28(2).

types: BEGIN OF t_mara,

matnr TYPE mara-matnr,

ernam type mara-ernam,

end of t_mara.

data: itab TYPE TABLE OF t_mara,

wa TYPE t_mara.

select matnr ernam FROM mara INTO TABLE itab

WHERE matnr BETWEEN '000000000000000001' and '000000000000000756'.

sort itab by matnr.

delete itab WHERE matnr is INITIAL.

LOOP AT itab INTO wa .

WRITE:/ sy-tabix,'!', wa-matnr, wa-ernam.

ENDLOOP.

DATA L_PAGE_COUNT(5) TYPE C.

WRITE SY-PAGNO TO L_PAGE_COUNT LEFT-JUSTIFIED.

DO SY-PAGNO TIMES.

READ LINE 1 OF PAGE SY-INDEX.

REPLACE '-----' WITH L_PAGE_COUNT INTO SY-LISEL.

MODIFY CURRENT LINE.

ENDDO.

TOP-OF-PAGE.

*end-OF-PAGE.

WRITE: /(70) SY-PAGNO,'/', '-----'.

Thanks in advance

krupali.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Use this code:

  • zlines number of lines in the table

  • sy-srows number of lines in screen

  • sy-cpage current page

  • zpages total number of pages type i

  • temp temporary number type f

describe table itab lines zlines.

temp = zlines / sy-srows.

zpages = trunc( temp ).

temp = frac( temp ).

if temp > 0.

zpages = zpages + 1.

endif.

  • zpages is the number of pages

write: /'Page ',sy-cpage, ' of ', zpages.

Make sure that you consume the 26 Lines..so that Footer should get print....

6 REPLIES 6

Former Member
0 Kudos

use end-of-page event

write:/ sy-pagno.

Former Member
0 Kudos

Hi,

insted of TOP-OF-PAGE event.... use the END-OF-PAGE event

and the write the same code over there

as you know for END-OF-PAGE to trigger all the lines you reserved in line count must be completed

so insert the following code befor the END-OF-PAGE event


  v_skip = sy-linct - sy-linno .

  SKIP v_skip.

END-OF-PAGE.

WRITE: /(70) SY-PAGNO,'/', '-----'.

where v_skip of type integer

sy-linct gives the line count you reserved in report statemnt

sy-linno gives the current line number

regards

Lakshmi

0 Kudos

Hi put your write statement for Data in START-of-Selection and

page number display at End-of-selection. it will do.

Jey

Former Member
0 Kudos

Hi,

Use this code:

  • zlines number of lines in the table

  • sy-srows number of lines in screen

  • sy-cpage current page

  • zpages total number of pages type i

  • temp temporary number type f

describe table itab lines zlines.

temp = zlines / sy-srows.

zpages = trunc( temp ).

temp = frac( temp ).

if temp > 0.

zpages = zpages + 1.

endif.

  • zpages is the number of pages

write: /'Page ',sy-cpage, ' of ', zpages.

Make sure that you consume the 26 Lines..so that Footer should get print....

0 Kudos

Hi Ajay,

Thank you very much. My issue hasbeen resolved.

Former Member
0 Kudos

hello try this:

REPORT zdemo_eof NO STANDARD PAGE HEADING LINE-SIZE 100 LINE-COUNT 28(2).

TABLES: zfdl_qsprot.

TYPES: BEGIN OF t_zfdl_qsprot,

datum TYPE zfdl_qsprot-datum,

uhrzeit TYPE zfdl_qsprot-uzeit,

END OF t_zfdl_qsprot.

DATA: itab TYPE TABLE OF t_zfdl_qsprot,

wa TYPE t_zfdl_qsprot.

DATA: l_page_count(5) TYPE n,

wa_line_count TYPE i,

wa_rest type i.

SELECT datum uzeit FROM zfdl_qsprot INTO TABLE itab

WHERE datum BETWEEN '01.01.2005' AND '31.12.2008'.

SORT itab BY datum.

DELETE itab WHERE datum IS INITIAL.

l_page_count = sy-dbcnt / 25.

l_page_count = sy-dbcnt DIV 25.

wa_rest = sy-dbcnt mod 25.

if wa_rest > 0.

l_page_count = l_page_count + 1.

endif.

CLEAR: wa_line_count.

LOOP AT itab INTO wa .

WRITE:/ sy-tabix,'!', wa-datum, wa-uhrzeit.

wa_line_count = wa_line_count + 1.

  • after 25th line page_no

IF wa_line_count = 25.

WRITE: /(70) sy-pagno,'/', l_page_count NO-ZERO.

CLEAR: wa_line_count.

ENDIF.

ENDLOOP.

  • last page not to forget

WRITE: /(70) sy-pagno,'/', l_page_count NO-ZERO.

regards

e.m.