Smart Forms Part 6: Tables, Templates, Loops and Conditions
Preview · a free account unlocks the full lesson
Choose the right node for structured output: table nodes for dynamic item lists with header/main area/footer, templates for fixed grids, loops, line types and cell layout, sorting and events (subtotals), calculations, and conditions on nodes.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 5 defined the windows of a Smart Form; inside the main window, it's the table node that actually prints the line items. A table node handles a dynamic number of rows, built from a header, a main area, and a footer, and its header can optionally repeat at the top of every page.
A template, by contrast, is a fixed grid with a fixed number of rows and columns — useful for things like an address block or a summary box where there's no looping involved. Table nodes also support sorting through events, which lets you print subtotals when a sort value changes, and they have a "Calculations" tab for totals.
On the table node itself, the Data tab defines the loop — for example, looping over IT_ITEMS INTO GS_ITEM, optionally restricted with a WHERE condition.
The Table tab defines line types (such as LINE_HEADER, LINE_ITEM, or LINE_TOTAL) along with their column widths and borders; note that line types must add up exactly to the table's total width, or you'll get errors or columns that visibly shift.
The header prints at the start of the table and, if configured for "at page break," on every new page as well. The main area prints one row per item, with cells containing text nodes that reference fields like &GS_ITEM-...&. The footer prints either at the very end, for totals, or at the end of each page.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Related SAP topics
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.