Skip to Content
author's profile photo Former Member
Former Member

Dont want header in the last page under TOP-OF-PAGE

Hi,

there are N no. of pages in the report for which the same header is diplayed for N no. of pages by using following code.

TOP-OF-PAGE.

perform write_header.

now the requirement is i dont want header in the the Nth page i.e., last page.

plz let me know tht am i thinking right by luking at below??

plz provide me the exact syntax.

TOP-OF-PAGE.

if SY-PAGNO = last page.

else

perform write_header.

endif.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Feb 24, 2009 at 02:40 PM

    How would you decide if last page is indeed your last page. Check the no of records left in the internal table that you are printing. if there are no more records left to print then you can move the sy-pagno to variable last_page and the your logic should work just fine.

    Try the syntax yourself, its very simple iam sure you can do it yourself.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Assume your header occupies 5 lines.

      Line-count 100.(Declare in Report Statement)

      Get number of rows in Itab using :

      DESCRIBE TABLE ITAB LINES <W_LINES>.

      SAy W_line = 875.

      on one page total number of records will be displayed = 100 - 5 = 95

      Total pages(T_Pages) = 875 Div 95 = 9 Pages

      So use :

      TOP-OF-PAGE.

      IF Sy-pagno = T_pages.

      Last page header.

      Else.

      Common_header.

      Endif.

      Hope this resolves your issue.

      Regards,

      Gurpreet

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 02:40 PM

    Hi friend,

    Use TOP-OF-PAGE DURING LINE-SELECTION and system variable SY-LSIND

    Do like below.

    TOP-OF-PAGE DURING LINE-SELECTION.

    if sy-lsind ne N. <----


    'N' is last page no

    perform write_header.

    endif.

    Thanks..

    Edited by: Sap Fan on Feb 24, 2009 3:40 PM

    Edited by: Sap Fan on Feb 24, 2009 3:41 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 24, 2009 at 03:13 PM

    >

    > TOP-OF-PAGE.

    > if SY-PAGNO = last page.

    > else

    > perform write_header.

    > endif.

    Hello,

    To know the total number of pages you have to try a workaround.

    You can try this approach & check ( This is never a fullproof approach 😉 )

    Say in your report you have mentioned LINE-COUNT as 60 & have no END-OF-PAGE block.

    REPORT  zxxxx
    LINE-COUNT 63(2)
    LINE-SIZE  157 NO STANDARD PAGE HEADING.

    And your TOP-OF-PAGE block has got 10 lines. So you can basically print 50 ( 60 - 10 = 50) table lines in all the pages & in the last page you can display total of 60 lines (since you donot have the 10 lines of the TOP-OF-PAGE block).

    DATA:
    V_PAGE TYPE I, "Total Pages with 50 lines
    V_TOT_PAGE TYPE I, "Total Pg. which will be printed
    V_LINES TYPE I, "Total Table Lines
    V_REM_LINES TYPE I. "Table Lines which need to be printed
    
    V_LINES = LINES( ITAB ). 
    
    V_LINES = V_LINES - 60.
    
    V_PAGE = V_LINES / 50.
    
    V_REM_LINES = V_LINES - 50 * V_PAGE.
    
    IF V_REM_LINES = 0.
      V_TOT_PAGE = V_PAGE + 1.
    ELSE.
      V_TOT_PAGE = V-PAGE + 2.
    ENDIF.
    

    Now you can use your coding:

    TOP-OF-PAGE.
      IF SY-PAGNO < V_TOT_PAGE.
        perform write_header.
      ENDIF.
    

    Hope this is clear.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 03:20 PM

    Hi friend,

    Try this link for finding total number of pages i.e (last page of report).

    Page 1 of 10 format in REPORT Out put

    Code:

    INITIALIZATION.

    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)

    WRITE: / sy-pagno,'of', m.

    As Sameer said use this also,

    TOP-OF-PAGE.

    IF sy-pagno = m.

    EXIT.

    ELSE.

    PERFORM write_header.

    ENDIF.

    Thanks...

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.