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: 

printing total pages in report in Background

Former Member
0 Kudos

Hi all,

I have a report that show the total pages in the following format 1/5, 2/5,3/5 ....when we run the program in mode foreground.

But my problem is that when I run the report in mode background the report shows the page in wrong mode: 1/**, 2/**, 3/3

and only show the total pages in mode correctly to the last page.

I have seen some topics with similar question, but neither of them is regarding in mode background.

Could anyone please help me with this question?

Thanks.

The code that I use is the following:

REPORT Z_TEST

NO STANDARD PAGE HEADING

LINE-COUNT 65

LINE-SIZE 80.

DATA: NUM_PAGES_C(10) TYPE C.

PERFORM WRITE.

PERFORM GET_TOTAL_PAGENO.

TOP-OF-PAGE.

WRITE:/(SY-LINCT) 'TEST - TEST' CENTERED.

WRITE: / SY-DATUM, 60 SY-PAGNO,'of', '*****'.

SKIP.

&----


*& Form WRITE

&----


  • text *

----


  • --> p1 text

  • <-- p2 text

----


FORM WRITE.

DO 200 TIMES.

WRITE:/ 'TEST', SY-LINNO.

ENDDO.

ENDFORM. " WRITE

&----


*& Form GET_TOTAL_PAGENO

&----


  • text *

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_TOTAL_PAGENO.

WRITE SY-PAGNO TO NUM_PAGES_C LEFT-JUSTIFIED.

DO SY-PAGNO TIMES.

READ LINE 2 OF PAGE SY-INDEX.

REPLACE '*****' WITH NUM_PAGES_C INTO SY-LISEL.

MODIFY LINE 2 OF PAGE SY-INDEX.

ENDDO.

ENDFORM. " GET_TOTAL_P

1 REPLY 1

Former Member
0 Kudos

Hi,

REPLACE '*****' WITH NUM_PAGES_C INTO SY-LISEL .This line does not work from your code

You can calculate the total no of pages alternatively.

Just get the total no of records from your data.Add header lines if you are printing them at the start of report.Then divide this count by sy-linct,which can give you total no of pages & then use it to print heading for each page.

Thanks.

Mark points if helpful.