smart forms ii
DESCRIPTION
SAP Smart FormTRANSCRIPT
SmartForms-II
Pages & Windows
• Second Top level Node in the Tree structure
• Sub-node ‘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 SAP Scripts
• The default page & window provided for a new Smart Form:
– DEFAULT PAGE: %PAGE1 (New page)
– DEFAULT WINDOW: MAIN (Main window)
2
Node ‘Page’
• Three main attributes
– General attributes
– Output Options
– Background Picture
• Form Painter shows the individual layout
• Page may be called statically or dynamically
3
Page: General Attributes
4
•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
• General attributes− Next page− Page counter
1. Format (Arabic numeral, Roman Caps, Roman Lowercase, Alphabets Caps, Alphabets Lowercase)2. Mode (Initialize counter, Increase counter, Leave counter unchanged, Page and overall page unchanged)
Page: Output Options
5
• Output options− Print attributes
• Page format (Portrait, Landscape)• Resource name, Print mode
Page : Background Picture
6
• Background picture 1.Name, Object, ID & BMON (Black & White), BCOL (Color), BMON BCOL 2.Output attributes : Resolution (in DPI)
Output mode (Print preview, Print preview and print) 3. Position : Horizontal (Left, Centered, Right)
Vertical (Top, Centered, Bottom)
Node ‘Window’• 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
• Creating a window
– General Attributes of a 'window' node
– Output Options
– Conditions
7
Creating a Window
8
Window : General Attributes
9
• General attributes Main window (Tells whether this is a main window or not)
Window Types
• Windows are output areas on your design page
• Various window types
– Main window: For continuous output (e.g. table output)
– Secondary window: For output with a fixed length
– Final window: Special secondary window for output of information that is not available until the end of form processing
– Copies window: Special secondary window for marking pages as copy or original.
Window : Output Options
11
• Output options 1. Position and size (Left margin, Upper margin, Width, Height) 2. Box and shading 3. Line (Width, Vertical spacing, horizontal spacing) 4. Shading (Gray value) 5. Always draw box and shading (Draw box and shading even if window is empty)
Window : Conditions• 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 available in a similar manner for ALL lower nodes
• 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
12
Window : Conditions (Contd.)
13
Pages & Windows: Successor nodes• 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 SAP Scripts was carried out by ABAP code written in driver program)
• Template, Table, Complex Section, Loop, Alternative, Program Line, Folder
14
• To display Graphics objects e.g. Logo
• Used same way as background picture
• TIFF, BMP, JPEG file may be used
• Maintain Graphics using transaction SE78
15
Basic Nodes: Graphics
16
Basic Nodes: Graphics (Contd.)
17
Address node
This has to be given along with address number
for personal address
This determines the format of address
Parameter that has the address number
Basic Nodes: Address
• 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 SAP Script)
– Text Modules
18
Basic Nodes: Text
19
Field list
Basic Nodes: Text (Contd.)
20
You can append the text directly to the output of the predecessor node or start it in a new paragraph or a new
line.
Text Nodes: Text Element
21
Text Nodes : Include Text
22
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
Text Nodes: Text Module
23
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).
Text Nodes: Maintaining Text Modules
• 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
24
Auxiliary Nodes
25
Template
• Data retrieval program sends the data through the internal table in the form interface
• To display, internal table data is to be processed in a loop
• Following Node Types offer Data tab which can be used to read internal table lines in a loop
26
Loop Accesses a tableOffers tab to determine data selection, Events (header & Footer)
Table Same as Loop, in addition offers Table LayoutUsed to display a table
Complex Section Combines all the attributes of Template, Loop & TableFor advances Form developers
Recurring Data
• Configured through three Tabs
• Table Tab (Display Layout)
– Line Type – 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 and/or page level
– If set, event nodes automatically added under Table node
27
Table
28
Defining Table Layout
29
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 control breaks are triggered
Defining Method of Data Retrieval
30
Defining Events
31
Defining Events (Contd.)
32
Loop
• The node type Complex section is a real all-purpose node. It allows to combine the tab pages of the node types Folder, Template, Table, and Loop in any way .
• This node type is not used any longer. The node types Folder, Template, Table, and Loop directly offer the correct nodes.
• Before the new node types for tables, templates, and loops were introduced, complex sections are used to deal with these constructions.
33
Complex Section
34
Display data in Template/Table/Loop/Complex Section
35
Alternative – Decision making node General Attributes/Conditions
1. Node/Output conditions (Field name, Relational operator, Comparison value)2. Additional event
Output attributes Style, Page protection option, Box and shading, Line, Shading 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
36
Command - Flow Control node
37
Program Lines
38
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:1. Events
• Header (Output event: at start of paragraph/at page break)• Footer with height <height> (Output event: at page break/ at end of paragraph)
2. Output options• As with other node types
3. Conditions• As with other node types• Any node type can be a sub-ordinate node to LOOP
Testing/Running Smart Forms
Function module name for this example Form
Find the Function module name
40
Downloading Smart Forms
Download Smart Form
Download Subtree
Upload Smart Form
41
Return to Active Version
Other useful functions
Undo Redo
• The following function modules are used for interfacing between the Smart Form and the Application Program:
– System generated Function Module (upon activation of smart Form) (Mandatory)
– SSF_FIELD_LIST (Optional)
– SSF_FUNCTION_MODULE_NAME (Optional)
– SSF_ERRORMESSAGE (Optional)
– SSF_READ_ERRORS (Optional)
42
Function Modules for Calling a Smart Form from the Application Program
• Steps to create the Main Program
– Find which form will be used and which parameters for data selection is required (Read from the message control or from individual selection screen of a standalone program)
– Call the function module SSF_FIELD_LIST to know which data the form needs (this step is optional).
– Read the database tables to prepare the data required for the smart form.
– Call the function module SSF_FUNCTION_MODULE_NAME to determine the name of the function module for the smart form.
– Call the function module of the smart form for output.
– Call the function module SSF_READ_ERRORS for error handling purpose (this step is optional).
43
Calling a Smart Form from the Main Program
Print Program of Smart Forms• In the data retrieval program define a variable of type rs381_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.
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.
Difference between SmartForms and SAPScripts (SE71)• Multiple page formats are possible in SmartForms which is not the case in SAPScripts
• It is possible to have a smartform without a main window .
• Labels cannot be created in SmartForms.
• Routines can be written in SmartForms tool.
• SmartForms generates a function module when activated.
• Unlike SAPScripts (RSTXSCRP), you cannot upload/download Smartform to your local hard disk.
• sap script is client dependent, smartform is client independent.
• sap script 99 main windows, smartform only one main window
• You can post sap scripts directly to web but this is not possible in the case of smartform.
Thank You!