SAP Tech Pro

SAP Technical Blog

SAP Smart Forms: Detailed guide to work with Smart Forms

SAP Smart Forms: Detailed guide to work with Smart Forms

Smart Forms

SAP Smart Forms: Detailed guide to work with Smart Forms

What is Smart Form

  • •Smart form is a tool to create & maintain Forms for mass printing

  • •Supports a printer, a fax, e-mail, or the Internet (XML) as output medium

  • •Faster development

  • •Completely GUI based, no or less programming effort involved

The SAP Smart Forms replace the SAP script forms. SAP script forms will also be supported in the future; you can use them without making any changes for years to come. You can use SAP script texts in the Smart Forms. Migration of SAP script forms into Smart Forms is supported.

Features

  • •Program for data retrieval and Form Logic for formatting are separated

  • •Data flows from driver/application program to the layout through a function module (generated when a Smart Form is activated)

  • •The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics

  • •Static and dynamic tables, triggering events for table headings and subtotals, and sorting data before output

  • •Graphics as background or as part of the form

  • •Client independent

Architecture

 

SAP Smart Forms: Detailed guide to work with Smart Forms

Layout of the form – pages & windows Individual elements – text, graphics, address, tables Form logic to read application data from internal tables & to control process flow Form interface to transfer application data to form definition

Creating Smart Forms

The transaction code is'SMARTFORMS'

menupath->‘SAPmenu->Tools->FormPrintout->SmartForms'.

Smartform can be created by either migrating an existing SAP script or either by copying existing smartform, apart from creating it a fresh.

Testing/Running Smart Forms

Execute the associated function module which has the pattern, /1BCDWB/SFxxxxxxxx.For exactname follow the menu path(in form builder screen),'Environment->Function ModuleName'.

Form Builder Components

    • •Form builder of SAP Smart Forms consist of

      • •Navigation tree (for form logic)

      • •Form Painter (layout of form)

      • •PC editor (entering texts into output area)

      • •Table Painter (template / table layout)

    • •Two root nodes

      • •Global Setting

      • •Pages & Windows

    SAP Smart Forms: Detailed guide to work with Smart Forms

     

    Global Setting: Form Attributes

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Global Setting: Form Interface

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Standard Import

    Global definition

    •Global Data

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Global definition

    •Types

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Global definition

    •Field Symbols

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Global definition

    • •Initialization

    • •Subroutine interface -Input & Output parameters

     

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Global definition

    • •Form Routines

    • •Here, you define all your subroutines (for eg., conversion before output). These can be accessed from 'program line' nodes or INITIALIZATION

     

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Pages & Windows

    • •2 nd Node in the Tree structure

    • •Subnode ‘Page’ can be created under this node

    • •System automatically creates the first page and ‘MAIN’ window under it

    • •The basic concept of Page, Window & Text element remain the same as in SAPScript

     

     

    Node ‘Page’

    • •Three main attributes

      • •General attributes

      • •Output Options

      • •Background Picture

    • •Form Painter shows the individual layout

    • •Page may be called statically or dynamically

     

    PAGE: General Attributes

    Give the page structure, which the subsequent page should adopt

    Give the format of page counters and the way in which they are to be incremented

    SAP Smart Forms: Detailed guide to work with Smart Forms

    PAGE: Output Options

    Tray of the printer from which papers for printing this page are to be taken

    Print mode SIMPLEX, DUPLEX, or TUMBLE DUPLEX

    SAP Smart Forms: Detailed guide to work with Smart Forms

    PAGE : Background Picture

    Name of the Graphic Object

    mostly, GRAPHIC

    BMAP or TIFF

    dynamically determined by mentioning the field e.g., &V_CHROME&

    to expand the fields, so that, parameters can be used

    'Print preview' or 'print preview and print'

    Higher the DPI, lesser the size (use original DPI)

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Windows

    • •Creating a window

    • •General Attributes of a 'window' node

    • •Output Options

    • •Conditions

     

    Windows :Creating a window

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Windows :General Attributes

    This has to be opted for if the window is to be a main window.

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Windows :Output Options

    This has to be opted for, if you want a box to appear on the window

    0-not filled at all, 100-black

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Windows: Output Condition

    • •In Smart Forms, a node and all successor nodes are processed only if the respective output condition is true

    • •A condition can either be a logical expression on field values or consist of events or position queries in the form processing

    • •Output Option & Condition are same for ALL nodes

     

    Windows :Conditions

    this symbol appears if the node has a condition defined.

    click here to select comparison operator

    additional conditions like, node to be executed only in first page, etc can be mentioned here

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Successor nodes of window/page

    • •Broadly Two categories

    • •Basic Node

      • •contents are actually printed (either as a part of an output area (window) or independently as part of a page

      • •Graphics, Address & Text

    • •Auxiliary Node

      • •can be used to control the flow of the layout

      • •basically used to incorporate the Form Logic (which in case of SAPscripts was carried out by ABAP code written in driver program)

      • •Template, Table, Complex Section, Loop, Alternative, Program Line, Folder,

    Graphics

    • •Company Logo

    • •Used same way as background picture

    • •Besides TIFF, BMP file may be used

    • •Maintain Graphics using SE78

    Address

     

    Address node

    Parameter that has the address number

    This has to be given along with address number for personal address

    This determines the fomat of address

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Text

    • •To print out any text (and table contents/ data), but not address

    • •Three types

      • •Text element (enter text in PC Editor)

      • •Include Text (Standard text as in SAPScript)

      • •Text Modules

    • •Parameters/global fields (defined in the form interface), system fields are printed using Text node

    • •System fields are in a structure SFSY

    • •Fields available inside the form can be seen by setting Field List-On

     

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Text: General Attributes

    You can append the text directly to the output of the predecessor node or start it in a new paragraph or a new line.

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Text Modules

    • •Central storage of texts used frequently in the forms

    • •Text maintenance separate from the form maintenance

    • •Cross-client

    • •Connected to the transport system

    • •Attached to the translation tools in the system

    • •For maintenance, use transaction SMARTFORMS

    • •Can be used in two ways –

      • •Refer to the text module –text appears as Read only in PC editor

      • •Copy the text module –system copies the text of the module and automatically converts the text node into an editable text element

     

    Text Module

    To copy the contents of text module, instead of referring to it. After copying, the property of text changes to 'text element'

    if this is opted for, then all the paragraph formats and char formats will come from the text module's style, else, default style of Form applies

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Maintaining Text Modules

    Transaction.. SMARTFORMS

    This is a normal PC editor where you can enter the text (fields, which are populated dynamically during run-time can also be used). the bad news is, there is no text editor here.

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Auxiliary Nodes

    Template-Output of a table containing static data

    Table-Output of a table containing application data

    • Loop -Processes successor node repeatedly.

    • Alternative-Branches depending on condition.

    • Command-Executes special commands

    • Folder-Combines successor nodes to logical groups

    • Complex Section-Combines all attributes of the node

    • types template, table, loop, folder

    • Program Lines-Executes ABAP program code

    Template

    • •Tabular layout for printing data (tabs in SAPScript !)

    • •Static, no. of rows & columns are known before runtime (e.g. heading for tabular data)

    • •Linetype defines the pattern of each row (no. of cells, cell width, row height)

    • •Length of a linetype exactly same as width of Table/Template

    • •Pictorial representation through Table Painter

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Display data in Template/Table

    • •Text nodes to be created under the node

    • •Text Node definition will determine in which Linetype & Cell it will be displayed

    Loop

    Accesses a table

    Offers tab to determine data selection, Events (header & Footer)

    Table

    Same as Loop, in addition offers Table Layout

    Used to display a table

    Complex Section

    Combines all the attributes of Template, Loop & Table

    For advances Form developers

    Displaying Table Data

    • •Data retrieval program sends the date through the internal table in the form interface

    • •To display, table data are to be processed in a loop

    • •Following Node Types offer Data tab which can be used to read table lines in a loop

    37

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Table

    • •Configured through three Tabs

    • •Table Tab (Display Layout)

      • •LineType –same as in Template

    • •Data Tab (Method of Data Retrieval)

      • •Internal table

      • •Workarea

      • •row selection &/or Where Condition

      • •Sorting & Control Level

    • •Events Tab

      • •Header & Footer at section &/or page level

      • •If set, event nodes automatically added under Table node

    Defining Table Layout

     

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Defining Method of Data Retrieval

    workarea, if 'INTO', otherwise Field Symbol

    specify range of line numbers; if left blank, loops through all rows

    to put an 'OR' condition click on this (default is 'AND')

    if any of these two checkboxes are opted for, an event node gets generated (as a successor node of this table), which will be processed, when their respective contro breaks are triggered

    sorts by pernr, in ascending order

    SAP Smart Forms: Detailed guide to work with Smart Forms

    More about Control Breaks

    this event corresponds to' 'End of Control Level' declared above

    print the subtotals here

    In this case, a control break event is triggered every time the sorted field, PERNR changes its value (so, its similar to specifying, 'On Change Of PERNR' inside a loop in an ABAP program) and we can have special tasks performed inside this event, like printing subtotals in a text elements (which have to be created as successors of this event).

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Defining Events

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Loop

    • •Same as ‘Table’ node, except the data layout

    • •For repeated processing of successor nodes (kind of flow control)

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Complex Section

    • •One more Tab –General Attribute, rendering it as either Template, Loop or Table

    If this is ticked, then u can loop at an internal table(inside 'DATA' tab)

    neither table not template, can be used as loop

    For Table, ('table' tab appears)

    instead of 'table' tab, u will see a 'Temmplate' tab

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Flow Control node –Alternative

    • •To apply ‘IF-ELSE’ logic, if successful, successor node is executed

    • •Condition tab in each node also helps building up such logic

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Flow Control node –Command

    • •used to change spool settings/trigger new page/change paragraph setting/setting printer control

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Program Lines

    • •Free flow ABAP code opportunity

    • •To calculate subtotal or for data refinement –e.g. conversion routine

    • •Interface defined thru input & output parameter (global fields not accessible if not defined)

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Folder

    • •Non executed node

    • •To group all similar nodes –to better organize the nodes in a complex Form

    SAP Smart Forms: Detailed guide to work with Smart Forms

    Style Builder

    StyleBuilder is a tool used to maintain ‘Smart Styles’ where we define character format sand paragraph formats.These are not explicitly defined in a smart form.but, the Smart Style in which required Formats are defined is referred to in the smart form.

    Transaction-> SMARTSTYLES

    Where to Get More Information

    • •SAP Online help

    • •Try ‘F1’s and ‘F4’s wherever possible

    Add comment

    Before Buying, Compare Prices at Topprice.in

    Topprice.in