Smart Forms
Smart Forms - Pre-requisite
Pre-requisite
SAPScript
Smart Forms - Overview
Create/maintain
forms for mass printing
Replaces SAPScript
SAPScript will also be supported
Create forms in half the time
No programming knowledge required
XML output for Web
Graphical User Interface
3
Smart Forms - Features
Simple modifications without any programming knowledge
Data retrieval and form logic separated
ABAP program implements data retrieval
Smart Form implements form logic
Smart Form generates a function module upon activation
Data retrieval program passes data through function module parameters
Graphical Design tools
Graphical Form Painter
- Represents form logic in a tree structure
Graphical Table Painter
- Static and dynamic tables
- Sorting, headings, subtotals
XML output used for Web
Graphics can be included as background/on any part of the form
Architecture
ABAP program
SQL statements
CALLS
Function module
Document
ACTIVATE
HEADER
ADDRESS
LOGO
INFO
MAIN
FOOTER
Database tables
SMART FORM
DATA RETRIEVAL
FORM LOGIC
SAP Smart Forms - Transaction: smartforms
Form Builder
Navigation tree
Maintenance Screen
Form Painter
7
Global settings
Form Attributes
General Attributes
Created by/date/time
Changed by/date/time
Development class/language
Output options
Page format, Chars per inch, lines per inch, Style
XSF output (XML output)
Form interface
[Data passed from ABAP program -> function module -> Smart form using these]
Import, Export, Tables, Exceptions parameters
Global definitions
[Global Data/Routine declaration for the form logic]
Global data, Types, Field symbols, Initialization, Form routines
8
Pages & Windows
The default page & window provided for a new Smart Form:
DEFAULT PAGE: %PAGE1 (New page)
DEFAULT WINDOW: MAIN (Main window)
Navigating to the attributes of a page/window
Double-click the element whose attributes are to be changed/viewed
The attributes/definition of the element appears in the Maintenance Screen
To change the name of %PAGE1
Double-click in %PAGE1
Its definition is shown in the Maintenance Screen
Change the Page name
10
Page definition
General attributes
Next page
Page counter
Format (Arabic numeral, Roman Caps, Roman Lowercase, Alphabets Caps, Alphabets Lowercase)
Mode (Initialize counter, Increase counter, Leave counter unchanged, Page and overall page unchanged)
Output options
Print attributes
Page format (Portrait, Landscape)
Resource name, Print mode
Background picture
Name, Object, ID & BMON(Black & White), BCOL (Color), BMON BCOL (Dynamically determined)
Output attributes
Resolution (in DPI)
Output mode (Print preview, Print preview and print)
Position
Horizontal (Left, Centered, Right)
Vertical (Top, Centered, Bottom)
11
Working with pages
[Following operations can be done by
right-clicking on a page or from Edit menu]
Normal operations with tree node
Cut, Copy, Paste, Delete page
Expand, Collapse element list under a
page
Creating elements
Page - Creating more pages
Window - Creating windows in the
selected page
Graphic - Embedding graphic in the
selected page
Address - Including address in the
selected page given an address number or
person number
12
Window definition
General attributes
Main window (Tells whether this is a main window or not)
Output options
Position and size (Left margin, Upper margin, Width, Height)
Box and shading
Line (Width, Vertical spacing, horizontal spacing)
Shading (Gray value)
Always draw box and shading (Draw box and shading even if window is empty)
Conditions
Output conditions (Field name, Relational operator, Comparison value)
Additional event
Only on first page
Not on first page
only after end of main window
only before end of main window
only on page <pagename>
only at page break
only at paragraph beginning
only at paragraph end
13
Working with windows
[Following operations can be done by
right-clicking on a page or from Edit menu]
Normal operations with tree node
Cut, Copy, Paste, Delete page
Expand, Collapse element list under a
page
Creating elements
Windows - Creating more windows in the
same page
Graphic - Embedding graphic in the
selected window
Address - Including address in the
selected window given an address number
or person number
Text - Text element/Text module/Include
text
Alternative - Branching depending on
condition
Command - Executes special commands
(next page, paragraph numbering, printer
control)
14
Working with windows [Contd.]
[Following operations can be done by
right-clicking on a page or from Edit menu]
Creating elements [Contd.]
Program lines - Executes ABAP program
code like conversion routines
Folder - Logical grouping of nodes
Loop - Repeated processing of
successor nodes
Table - Outputs table containing
application data
Template - Outputs table containing static
data such as table headings
Complex section - Combines all node
types like folder, table, template, loop.
15
Creating windows, graphic, address
Click here and draw an area in the form painter to create windows, graphic, address
Navigation tree
Maintenance Screen
Form Painter
16
Node type: Graphic
Graphic can be included as background graphic or as a part of the page such as
company logo or as a part of a window
Background graphic
Set background graphic in the Background picture tab of the page
As a part of the page
Name, Object, ID & BMON(Black & White), BCOL (Color), BMON BCOL
(Dynamically determined)
Output attributes
Resolution (in DPI)
Output mode (Print preview, Print preview and print)
Position
Horizontal (Left, Centered, Right)
Vertical (Top, Centered, Bottom)
As a part of a window
All attributes are same as above except that Horizontal positioning can be made
with reference to window or last paragraph.
17
Node type: Address
Address can be included as a part of the page or as a part of a window
As a part of the page
Type (Organization address, Personal address, Workplace address,
Determine dynamically)
Number (Address number, person number)
Additional address specifications
Paragraph format
Number of lines to be used
Sending country
If PO box and street exists, which one to be used
Output attributes
Style
Position and size (Left margin, Upper margin, Width, Height)
Box and shading
Line (Width, Vertical spacing, horizontal spacing)
Shading (Gray value)
18
Node type: Address
Conditions
Output conditions (Field name, Relational operator, Comparison value)
Additional event
Only on first page
Not on first page
only after end of main window
only before end of main window
only on page <pagename>
only at page break
only at paragraph beginning
only at paragraph end
As a part of a window
All attributes are same as above except that there is an additional option for Page
protection
19
Node type: Text
Displays all text in a form
Types:
Text
element
Enter a new text in PC Editor
Text modules
Include a text module
Include text
Include existing SAP Script text
Text node: [Positioning of the text in the form]
New paragraph
New line
Append directly
Type the text and
click save
20
Node type: Text - Text element
Use PC Editor to enter text
PC Editor: With basic text editing options along with Paragraph and Character
formats
Fields like &WA_SFLIGHT-CONNID& can be included by
Directly typing in the PC Editor
Dragging and dropping from Field list
[Field list can be enabled by clicking
button on Application toolbar (OR) by
selecting Field list on/off from Utilities menu
Field list includes
Import interface, Export interface, Tables defined in Form interface
Global data defined in Global definitions ]
21
Field list
Type the text and
click save
22
Node type: Text - Text modules
Select text module to be included
Options to include text modules:
Refer to text module
Reference to the text module is made.
Text appears in read-only form in PC Editor.
Text included while printing the form
Copy text module
Text from text module copied and an editable text element
created
Always copy style from text: Use this option to override style in current
Smart form with that from the original text module
23
Node type: Text - Include text
Select standard text module to be included
This is similar to the INCLUDE statement in SAP Script
They are texts of object TEXT and ID ST
Maintain these texts through SO10
If the text key of the include text is incorrect (not found in the system),
an error message is issued.
No error if no text exists - Use this option to suppress the error
message.
Format paragraphs:
Standard paragraph - Format for standard paragraph format (*)
First paragraph - Format of first paragraph
24
Node type - Alternative
General Attributes/Conditions
Node/Output conditions (Field name, Relational
operator, Comparison value)
Additional event
Only on first page
Not on first page
only after end of main window
only before end of main window
only on page <pagename>
only at page break
only at paragraph beginning
only at paragraph end
Output attributes
Style
Page protection option
Box and shading
Line (Width, Vertical spacing, horizontal
spacing)
Shading (Gray value)
25
Node type - Alternative - Events: TRUE, FALSE
Output attributes
Style
Page protection option
Box and shading
Line (Width, Vertical spacing, horizontal
spacing)
Shading (Gray value)
Sub-ordinate node types for TRUE and
FALSE events [basically any other node]
Graphic
Address
Text
Alternative
Command
Program lines
Folder
Loop
Table
Template
Complex section
26
Node type - Command
General attributes
Go to new page <pagename>
Reset paragraph numbering (B: Paragraph
justified, L: Paragraph left-aligned)
Include printer control
Spool attributes (Field name, value)
Conditions
Output conditions (Field name, Relational operator,
Comparison value)
Additional event
Only on first page
Not on first page
only after end of main window
only before end of main window
only on page <pagename>
only at page break
only at paragraph beginning
only at paragraph end
27
Node type - Program lines
28
Node type - Program lines
Apart from the common attribute Conditions,
Input parameters
Output parameters
PC Editor for editing the code
Can be used to insert program lines at appropriate places for total/sub-total calculation.
Apart from the common editor features, the following are available
Syntax check
Statement constructor
Pretty printer
29
Node type - Folder
When the form is real complex, there will be many nodes and form would not be clear.
To avoid this, combine related nodes under a folder.
Folder has:
Events
Header (Output event: at
start of paragraph/at page
break)
Footer with height <heigth>
(Output event: at page break/
at end of paragraph)
Output options
As with other node types
Conditions
As with other node types
Any node type can be a subordinate node to LOOP
30
Node type - Loop
Use LOOP to read processor successor nodes repeatedly [For example, read lines
of an internal table
LOOP node has
Data
LOOP
Internal table <inttable> into <workarea>
Line x to y
WHERE condition <Fieldname> <Operator> <Comparisonvalue>
SORT criteria (already sorted, <fieldname> <asc/desc>
<Beginofcontrollevel> <EndofControllevel> )
Events
As with Folder
Output options
As with other node types
Conditions
As with other node types
Any node type can be a sub-ordinate node to LOOP
31
Node type - Loop
32
Node type - Table
To display contents of internal table passed from data retrieval program
TABLE node has
Table [Table display attributes]
Table width
Horizontal alignment
Line type definition (Line type, Default, No page break, Column
width & Unit of measure for each column)
Table pattern
Data - As in LOOP
Events - As in LOOP
Output options - As in LOOP
Conditions - As in LOOP
33
Node type - Table
34
Node type - Table - Unframed Table Patterns
35
Node type - Table - Framed Table Patterns
36
Node type - Table - Table Painter
Graphical User Interface to
Drawing lines and columns
Inserting, cutting, copying, and
deleting lines
Deleting cells
Changing cell size and moving
cell separator lines
Splitting cells Selecting table
patterns
37
Node type - Template
To display a static table of data whose size and layout is known before runtime. For
example, to print table heading for an internal table
TEMPLATE has
Template [template display attributes] similar to Table display attributes.
Table Painter can be used to graphical design the layout
Output options
As with other node types
Condition
As with other node types
38
Node type - Template
39
Node type - Complex section
Can be
Folder
Template
Table
Loop
Has
General attributes to define its type
Events
As with LOOP/TABLE
Output options
As with other node types
Conditions
As with other node types
40
Node type - Complex section
41
Print Program of Smart Forms
In the data retrieval program define a variable of type rs281_fnam for the name
of the generated function module:
data fm_name type rs38l_fnam.
Call function module SSF_FUNCTION_MODULE_NAME. It returns the name
of the generated function module:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = '<form name>'
IMPORTING
FM_NAME = fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
42
Print Program of Smart Forms
Call the generated function
module. Use Pattern of
ABAP Editor for calling
function module to avoid
having to copy all interface
parameters manually. Then
replace the function module
name with the variable
fm_name.
In this example, three
variables and an internal
table are passed. The
parameters G_CARRID,
G_CONNID, G_FLDATA,
and GT_SBOOK have been
defined before in the form
interface. In the interface
pass all data you want to
transfer to the form.
43
THANK YOU
44