I am using Smart Forms to print a template. I have passed an internal table containing different line items from the driver program using the function modules (used for Smart Forms). Now in the Smart Forms I have looped through the template using the internal table and work area in the Smart Form, but still only one page is getting printed. What is the problem?
If I loop the internal table in the driver program at the point of the function modules, the print preview gets repeated.
There are a number of possible explanations for your problem. Here are some things to check:
1) Did you create a table or a template? Your question uses the word "template" several times. Please understand there is a significant difference between the two in a Smart Form. A template is designed primarily for fixed information, such as a grid in a secondary window. A table – which is what you need here – is designed for information of unknown height (until runtime, anyway) but fixed width. It is always found inside a MAIN window.
2) Does your form consist of multiple mapped pages? A form can consist of a single named page (e.g. FIRST). However, it needs to be told what to do when that page fills up. At that point, it can print info to the same page (i.e. a second page is generated with the same look and feel), or to a different page, or to none at all.
3) Have you verified that the entire table is passing into the form? Perhaps there is something amiss in the way data is passed or declared. To check this, set a break-point in your Initialization section and pass the internal table into it. Alternately, create a program node with a break-point inside the table and pass the table's work area into it. See what the values are at that point.
4) Are the nodes which print the table's work area properly contained within the table body? Sometimes it is difficult to tell whether a node is inside another node or at the same level. A quick way to check this is to expand and collapse the table and see whether these nodes appear then disappear when you do so.
Since you are working with a Smart Form, I would recommend against putting the loop inside the print program itself. Output loops there are designed for dealing with changes to header info, not line item info. This is a major distinction between SAPscript and Smart Forms.
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