Start of Content Area

Background documentation Processing Loops and Tables  Locate the document in its SAP Library structure

Overview

When you use a loop or table node, you usually specify an internal table. SAP Smart Forms reads the table line by line to retrieve the data. Since the number of entries in such a table can be too large to fit onto one page, use a main window for table output.

When you print a table, the size of a table is determined dynamically. The output control must consider several heights to calculate a page correctly:

When processing a table, SAP Smart Forms does not calculate the space required for the entire table in advance, but determines for each line whether it still fits onto the current page.

Footer

With table output, besides using the main area for output of table lines, you will frequently print a header and footer. If the footer is printed at the end of each page, the output control must consider the footer height when determining the position of the automatic page break. Therefore, you must specify a height for the footer output. If you don't, then the output control cannot reserve any space at the end of the main window and thus not print the inferior nodes of the footer before the page break.

Automatic Page Break vs No Break

The output control triggers an automatic page break to print contents on several pages. As a form developer, you may not want the system to automatically break a page, for example, if you want to print all lines of a table on one page. For these table lines, you must specify No Break with the line type to prevent the system from breaking up the table at the end of the main window for space reasons. If there is not enough space left on the current page, the entire table will be printed on the next page.

Note

For all other output, you can use the output option Page Protection instead of No Break .

Processing

Requirements for Automatic Page Breaks

During output SAP Smart Forms must determine dynamically whether the output still fits onto the current page. Otherwise it must trigger a page break. When processing tables, this is of special importance, since the table lines are not printed immediately after the corresponding node is processed. Whenever a new line starts, the output control must determine the height of it. To do so, it stores the entire line in a buffer. The following examples illustrate why:

Example

The cells within a table line contain data that may be printed on one as well as on several lines. If the line type is protected against page break, all cells of the table line must be printed on the page. This depends on the height of the highest cell within the table line.

Example

Even if the table line type is not break-protected, a subsequent cell might contain a graphic which is higher than the first cells.

These examples illustrate that the output control can determine the height of each line only by analyzing the entire line in the buffer.

Process Flow

For form development not every detail of the output control is important. We want to concentrate on two questions: When is the footer processed? How is the automatic page break determined?

  1. If you activated output at the beginning of the table or at a page break, the header is processed and printed.
  2. With the old table node, output of the first inferior node, for which the output option New Line is marked, determines the end of the current line as well as the beginning of a new line. With the new table node you specify the end of the line by explicitly creating table lines. In both cases, SAP Smart Forms calculates at this event wheter to execute an automatic line feed:
    1. If the buffer already contains a table line, this is the line of the previous loop pass. With the beginning of the new line, the output control can now check whether the buffered line still fits onto the current page, thereby considering the yet unprinted footer (provided it must be printed before the page break):
    1. The output control buffers the table line of the current loop pass to determine its height. However, this line is printed only during the next loop pass.
  1. After processing the last inferior node, processing resumes with the first inferior node of the table (in the main area, with new table nodes).

Program Lines Nodes

Nodes of type program lines must be considered separately:

The program lines nodes within a table or loop are processed in the desired sequence and only once per loop pass. But note that due to the mechanism described above they are executed out of sync with the output (with the new table node as well).

Note

The section Summing Up Different Currencies describes how you can use program lines nodes to print correct totals.

The procedure described there is required only if you want to sum up values with different currencies or measurement units. Otherwise you can use the Calculations tab of the new table node and avoid pondering about how to process the loop.