2007 Aug 31 10:30 AM
Dear Friends,
Iam trying to print sy-pageno / total no of pages in top of page . iam doing the calculation part like this.
DATA:a TYPE i,
b TYPE i,
check.
a = sy-linct - 14.
b = sy-dbcnt / a.
c = TRUNC( b ).
check = sy-dbcnt MOD a.
IF check <> '0'.
c = c + 1.
ENDIF.
WRITE: sy-pagno, 'OF', c.
but the problem is iam not able to get value of 'C'(total number of pages),is not getting triggered.can any help me out of this
2007 Aug 31 10:40 AM
hi gopi,
Check this code
ABAP Report Page Number
The code below shows how to display the total number of pages in a report like "Page 1 of 8." However, it doesn't work if you execute the program as a background jobs.
Declare a variable
DATA L_PAGE_COUNT(5) TYPE C.
Copy this code to the end of program
Page count will be printed on each page here
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.
WRITE: /(70) 'Heading' CENTERED, 70 SY-PAGNO,'of ', '-----'.
Regards,
Kumar.
2007 Aug 31 10:35 AM
you havent declared variable C.
plz check it.
Else its working fine.
Regards,
Vimal
2007 Aug 31 10:36 AM
Hi,
Why you r doing both try like below
a = sy-linct - 14.
b = sy-dbcnt / a.
c = TRUNC( b ).
OR
a = sy-linct - 14.
do.
check = sy-dbcnt MOD a.
IF check <> '0'.
c = c + 1.
else.
exit.
ENDIF.
enddo.
Satya.
2007 Aug 31 10:38 AM
Hi gopi,
please consider letting SAP to do that automatically. It's much easier! Example:
TOP-OF-PAGE.
bhdgd-line1 = sy-title.
bhdgd-line2 = space.
bhdgd-lines = sy-linsz.
bhdgd-uname = sy-uname.
bhdgd-repid = sy-cprog.
PERFORM batch-heading(rsbtchh0).
ULINE.
I hope this helps. Best regards,
Alvaro
2007 Aug 31 10:40 AM
hi gopi,
Check this code
ABAP Report Page Number
The code below shows how to display the total number of pages in a report like "Page 1 of 8." However, it doesn't work if you execute the program as a background jobs.
Declare a variable
DATA L_PAGE_COUNT(5) TYPE C.
Copy this code to the end of program
Page count will be printed on each page here
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.
WRITE: /(70) 'Heading' CENTERED, 70 SY-PAGNO,'of ', '-----'.
Regards,
Kumar.
2007 Aug 31 10:43 AM
Hi,
The code below shows how to display the total number of pages in a report like "Page 1 of 8." However, it doesn't work if you execute the program as a background jobs.
Declare a variable
DATA L_PAGE_COUNT(5) TYPE C.
Copy this code to the end of program
Page count will be printed on each page here
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.
WRITE: /(70) 'Heading' CENTERED, 70 SY-PAGNO,'of ', '-----'.
Regards
Sudheer
2007 Aug 31 10:55 AM
Hi Gopi..
This is the code to Print the Page No as u need...
test this below code. You will get the clear idea.
REPORT YJAM_WA no standard page heading line-count 60(5).
data: v_totpage type i.
data: v_temp(3) type c.
Start-of-selection.
do 100 times.
write:/ sy-index.
enddo.
end-of-selection.
v_temp = v_totpage.
do v_totpage times.
read line 1 of page sy-index.
replace '@@@' in sy-lisel with v_temp.
modify line 1 of page sy-index.
enddo.
top-of-page.
write:/60 'page', sy-pagno, '/','@@@'.
v_totpage = sy-pagno.
<b>REWARD IF HELPFUL</b>