SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Page X of XX in report



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> List Generation, LDB, Spool Process, SAP Query, Report Painter
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Wed Sep 05, 2007 7:54 pm    Post subject: Page X of XX in report Reply with quote

Author: Jatra Riwayanto

Description:
This code will create Page X of XX in header report.


This code will display report without page of.
Code:
REPORT  Z_PAGEOF NO STANDARD PAGE HEADING
                 LINE-COUNT 65(2).

*-----------------------------------------------------------------------
* T.A.B.L.E.
*-----------------------------------------------------------------------
TABLES: PA0001.

*-----------------------------------------------------------------------
* D.A.T.A.
*-----------------------------------------------------------------------
DATA: PAGES(5) TYPE C.

*-----------------------------------------------------------------------
* T.O.P.  .O.F.  .P.A.G.E.
*-----------------------------------------------------------------------
TOP-OF-PAGE.
  SKIP.
  WRITE: /3 'Employee List Report' LEFT-JUSTIFIED, 85 'Page: ',  SY-PAGNO.
  ULINE.
  WRITE: /(20) 'Personal Number' CENTERED, (40) 'Name' LEFT-JUSTIFIED.
  ULINE.

*-----------------------------------------------------------------------
* E.N.D.  .O.F.  .P.A.G.E.
*-----------------------------------------------------------------------
END-OF-PAGE.
  ULINE.

*-----------------------------------------------------------------------
* M.A.I.N.  .P.R.O.G.R.A.M.
*-----------------------------------------------------------------------
START-OF-SELECTION.
*   Report output
    SELECT *
    FROM PA0001.
      WRITE: /(20) PA0001-PERNR CENTERED, (40) PA0001-ENAME LEFT-JUSTIFIED.
    ENDSELECT.


Lets create simple modification that will display Page X of XX.
Replace code in TOP-OF-PAGE:

Code:
WRITE: /3 'Employee List Report' LEFT-JUSTIFIED, 85 'Page: ',  SY-PAGNO.


with this code:

Code:
WRITE: /3 'Employee List Report' LEFT-JUSTIFIED, 85 'Page: ', SY-PAGNO,'of ', 'PAGEOF'.


Now we need replace 'PAGEOF' with total pages.

Add this code at START-OF-SELECTION below SELECt * ENDSELECT statement.

Code:
   
*   Print Page Number on each page
    WRITE SY-PAGNO TO PAGES LEFT-JUSTIFIED.
    DO SY-PAGNO TIMES.
        READ LINE 2 OF PAGE SY-INDEX.
        REPLACE 'PAGEOF' WITH PAGES INTO SY-LISEL.
        MODIFY CURRENT LINE.
    ENDDO.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> List Generation, LDB, Spool Process, SAP Query, Report Painter All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.