Skip to Content
avatar image
Former Member

Multiple page printing in sap scripts


I have a requirement in scripts like how to print footer windows only after the end of main window.

Likewise in smartforms we check a option to print footer windows only after end of main window,but such option is not available in scripts.

I have even used the system defined variable PAGE(which stores present page number) and SAPSCRIPTS-FORMPAGES(which stores total number of pages) by comparing them with a if condition but it was unsuccessful because total number of pages is triggering at end of page printing.

So i need suggestions regarding that as i was working on a PO print form . If a PO has multiple line items amount in words,tax conditions,remarks and signature should be printed only after the end of all line items.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 11, 2011 at 04:55 PM

    Hi Venkat

    I'm almost sure that the way you describe: Compare if current page number equals total number of pages - will actually work.

    I'm not sure however, why this was not successful in your case.

    Best regards


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 12, 2011 at 03:03 AM

    There are different ways of doing, for printing footer window only after the end of main window.

    Option#1 : Count the number of line items that will be displayed in your main window, and place a condition in your footer window if line item count equal to the above count, then display the footer.

    Example: Total line items are count = 15, and each page can only display 5 line items.

    In you main window.

    m_Counter = m_counter + 1.

    In your footer window.

    If count = m_counter.




    Create an element footer in your main window after your line items, once all line items are displayed then call the element footer in your main window. But only drawback is footer position will not be fixed it varies from form to form based on line items.

    Option #3.

    Count number of line items.

    Ex: Total items are Count= 25, and first page of your script can print 10 and second page can print 10 and 3rd page can print 10 line items in main window.

    Build a logic in your subroutine poll.

    Total_count = count / 10. "Total_count = 25 / 10 that is 2.

    Rem = count MOD 10. "REM = 25 MOD 10 that is 3.

    IF Rem > 0.

    Total_count = Total_count + 1. " 2 + 1 that is 3.


    In footer window.


    **Display footer


    I hope that above options may help your to close the thread.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi sai,

      Thanks for your reply...your inputs are really helpful but rather than going for your options,i have used the option given by Thomas if &nextpage& eq 0 and it worked.anyways thanks for your help.