Preface – This post is part of the ABAP Beginner series.
As we have discussed already in the previous tutorial about the Form Builder, let’s see about the Form Logic in SAP SmartForms.
In SAP SmartForms, the form logic defines the data to be read from the database, the conditions, and controls the flow of the form output. The form logic is described by the form structure on the left pane of the Smart Forms interface.
Nodes in SmartForms
When a new Smart form is created, there are default nodes on the left side. Global Settings and Pages and Windows are the two roots that are created by default for every Smart Form.
The Global Settings node has 3 sub-folders, namely Form Attributes, Form Interface, and Global definitions. The Form Interface contains the data which will be passed to the Smart Form from the calling ABAP program and the Global Definitions contain the data that are available throughout the Smart Form.
Defining Form Logic in SAP SmartForms
To define the form logic, a hierarchical structure has to be defined under Pages and Windows in Navigation Window. This hierarchy determines the rules for processing the Smart Form.
The form logic is used to control the flow of the form output. The following rules for form logic should be remembered:
- In the tree structure, a tab is defined in the Maintenance Window for every node to link the node to a condition. If the condition is fulfilled, the node is processed and if not, then the node is skipped as well as all its sub-nodes.
- The nodes are processed from top to bottom.
- The page break on each page depends on how much space is left on the current page.
- A next page should be defined for each page and flow control is defined for each page. However, one can go to other pages dynamically.