Q
Problem solve Get help with specific problems with your technologies, process and projects.

SAPScript output with first page, multiple 'next' pages and last page

I am working on a SAPScript output that needs a first page, multiple 'next' pages and a last page. The last page...

needs only to be one page long as it needs to have terms and conditions printed on it.

My problem is that on the 'pages' window I can create a last page but I don't know how to 'point' to it. In the section at the bottom of the screen that says standard attributes there is a field called 'next page'. If I write 'next' in this field (for page 'next') then I can get multiple pages to print but of course no last page as nothing is pointing to this page.

If I write 'last' in this field then I get only one next page output but I do get the last page data.

I need multiple next page outputs and also the last page output. Please can you tell me how to do this?


 

You are correct in your observation that the 'next page' field does not offer much help when it comes to printing a FIRST page, multiple NEXT pages *and* a LAST page. In this situation, the correct entry in this field for page FIRST and NEXT is 'NEXT'. A simple method to get the LAST page to print is to insert a set of commands in your print program at the end of standard form processing (i.e. after pages FIRST and NEXT have printed completely).

Here's how to proceed: In the program, locate the existing 'CLOSE_FORM' command. Just before it, insert a call to function 'START_FORM', specifying that STARTPAGE = 'LAST'. Print any page windows necessary, such as TERMS, then call function 'END_FORM' (all before the 'CLOSE_FORM'). If you haven't already, bookend your existing output with 'START_FORM' and 'END_FORM' logic as well.

So the code would look something like this:

   Call function 'OPEN_FORM'

EXPORTING

Form = 'Z_FORM'…

Call function 'START_FORM'.   "Default startpage = FIRST
              ...
        [Print all standard form pages]

   Call function 'END_FORM'.         "Printed everything but T&C
   Call function 'START_FORM'      "Start a new page

EXPORTING

Startpage = 'LAST'.   "Direct access to page LAST

Call function 'WRITE_FORM'

      EXPORTING

Window = 'TERMS'.   "Final page T&C
   Call function 'END_FORM'.              "End of printing page LAST
 
   Call function 'CLOSE_FORM'.

Incidentally, another method of redirecting output to a page not mapped within the standard output flow is the 'NEW-PAGE' command which may be issued within the SAPscript form itself. Its basic syntax is NEW-PAGE xxx, where xxx is an optional parameter. This will force a page break and direct all subsequent output to page xxx. There are some important restrictions on use of this command. For instance, it can be used only within a MAIN window and it triggers immediate output of all remaining windows on the current page. You can find more information on this command in the SAP help portal. Visit http://help.sap.com. Navigate to section BC-SRV-SCR (Basis Services - SAPscript) and click on the subsection entitled "Style and Form Maintenance". Drill down further into "SAPscript Control Commands" and choose "Explicit Page Break: NEW-PAGE".


 

This was last published in December 2003

Dig Deeper on SAPscript and Smart Forms

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What about the paging? I mean, I have the following in a window called PAGE which repeats itself in all pages of the form:

Page &PAGE& from &SAPSCRIPT-FORMPAGES(3ZC)&

However, if the output is 2 pages it does not print
page 1 of 2 but page 1 of 1
Cancel

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close