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".
Dig Deeper on SAP development and programming languages
Related Q&A from Mark Smithson
An SAP user is working with an SAPscript form to create the form development for an Invoice List, and wants to know if it's possible to migrate the ... Continue Reading
An SAP user is looking to fix an error with a packing slip print-out in an SAP Smart Form. Continue Reading
An SAP user is trying to align a barcode in the center of a defined window on an SAP Smart Form. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.