Professional Documents
Culture Documents
Page 1 of 1
INTRODUCTION .................................................................................................................. 4 1.1 WHAT ARE SMART FORMS?.......................................................................................................................4 1.2 HOW ARE SMART FORMS DIFFERENT FROM SAPSCRIPTS?........................................................................4 1.3 ARCHITECTURE: .......................................................................................................................................6 1.4 MAIN FEATURES OF SMART FORMS ..........................................................................................................6 1.5 CREATING SMART FORMS.........................................................................................................................8 2. ABOUT FORM BUILDER: ITS COMPONENTS.............................................................. 9 2.1 BASIC TREE STRUCTURE ...........................................................................................................................9 2.2 GLOBAL SETTINGS:.................................................................................................................................10 2.2.1 Form Attributes ..............................................................................................................................10 2.2.2 Form Interface ...............................................................................................................................10 2.2.3 Global Definitions: ........................................................................................................................12 3. PAGES AND WINDOWS .................................................................................................... 15 3.1 NODE 'PAGE' .........................................................................................................................................15 3.1.1 General Attributes: ........................................................................................................................15 3.1.2 Output Options: .............................................................................................................................16 3.1.3 Background Picture: ......................................................................................................................16 3.2 WINDOWS ...............................................................................................................................................17 3.2.1 General Attributes of a 'window' node:..........................................................................................17 3.2.2 Output Options: .............................................................................................................................18 3.2.3 Conditions:.....................................................................................................................................18 4. SUCCESSOR NODES OF WINDOW/PAGE.................................................................... 20 4.1 BASIC NODES..........................................................................................................................................20 4.1.1 Text.................................................................................................................................................20 4.1.2 Text Module ...................................................................................................................................22 4.1.3 Graphic ..........................................................................................................................................23 4.1.4 Address...........................................................................................................................................25 4.2 AUXILIARY NODES .................................................................................................................................25 4.2.1 Template.........................................................................................................................................26 4.2.2 Table ..............................................................................................................................................29 4.2.3 Loop ...............................................................................................................................................32 4.2.4 Complex Section.............................................................................................................................33 4.2.5 Alternative......................................................................................................................................34 4.2.6 Command .......................................................................................................................................35 4.2.7 Program Lines ...............................................................................................................................35 4.2.8 Folder.............................................................................................................................................36 5. APPENDIX A: STYLE BUILDER ..................................................................................... 37 5.1 HEADER DATA ........................................................................................................................................38 5.1.1 Standard Settings ...........................................................................................................................38 5.2 PARAGRAPH FORMATS ...........................................................................................................................39
1.
Page 2 of 2
PROLOGUE
Metamorphosis is an improved change in structure and function of an entity. The aspect of creation and maintenance of forms in SAP has metamorphosed from SAPscripts to Smart Forms. Smart Forms has revolutionized the creation and maintenance of forms in that, the same is more user friendly and consumes unbelievably lesser time. The overview that follows is structured in such a way as to help any technical person understand the content and use the same for handling this new feature of SAP with confidence. The principal sources that have served for the preparation of this technical paper include our ever helpful SAPs F1s and F4s , SAP 4.6C documentation on SAP Smart Forms, the fundamentals of SAPscripts that I gathered from interactions with my team leader Mr. Anupam Dutta and the results of various experiments that I am guilty of indulging in during the development of the Smart Form (Total Compensation Statement) for Nestle Project, which incidentally happens to be the first smart form development in i-SDC. This paper is introductory in nature and is first in the series of technical guides for Smart Forms. Suggestions are sought from the users so as to make the documents that shall follow better in terms of quality and content. I take this opportunity to thank my senior colleagues Mr. Samit K. Sen and Mr. Anindya Mitra for their valuable suggestions. - Taraka Chaitanya Vyas
Page 3 of 3
1. Introduction
Creating and maintaining forms requiring half the time (compared to SAPscript forms) Adapting forms (those provided by SAP or a custom one) without any programming knowledge due to entirely graphical user interface. Thus, a functional consultant without any programming knowledge can configure forms with data from an SAP System for the relevant business processes. Web Publishing using the generated XML output.
SAP quotes-"The SAP Smart Forms replace the SAPscript forms. But, SAPscript forms will also be supported in the future; you can use them without making any changes for years to come. SAPscript texts can be used in the Smart Forms. SAPscript forms can be migrated to Smart Forms."
Page 4 of 4
generated when a Smart Form is activated). So, calling a smart form from a driver program boils down to calling a function module. Database tables can also be accessed from the form . ! ABAP code can be written in Smart Forms; basically they can be used as though they are function modules, in defining local variables, subroutines, etc. Thus, Smart Forms can be run by just executing the concerning function module, without being called from a driver program (thus, they can be of stand-alone type). But writing DB selection codes in a form should be avoided as, it increases over-head, especially in the case of batch printing. ! There are some more minor differences like, instead of standard texts, text modules can be used in Smart Forms. Also, graphic object can be included directly in smart forms. These graphic objects can be maintained through the transaction, SE78. Address can be printed by just using the corresponding address number (if the central Address system is being maintained), and the format of it is automatically taken care of, based on the value given for country field. ! The system variables, which were available in SAPscripts aren't in Smart Forms. Different set of system variables is used. (for printing date, page no., etc). ! Any field inside a smart form accepts variables, instead of just hardcoded values. For example, the name of the text module to be used, name of the graphic to be printed, etc can be determined dynamically during run-time. ! Boxes and frames can be incorporated by just clicking at few checkboxes. ! Use of 'tabs', those ubiquitous pair of commas is almost redundant in Smart Forms, as the same functionality can be better achieved by using line types inside a template or a table node.
Page 5 of 5
1.3 Architecture:
First, you have an application program, which fetches the data from the Database. A Smart Form is created, the activation of which generates a function module. DB selections can also be done inside the Smart Form. The application program calls the function module in question, which in turn submits the print job to the spool.
Page 6 of 6
! 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. To make changes, use Drag&Drop, Copy&Paste, and select different attributes. These actions do not include writing of coding lines or using a Script language. ! For Web publishing, the system provides a generated XML output of the processed form. (This can be done through XSF option) ! Static and dynamic tables can be inserted. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output. In SAPscripts, this was all done in the driver program, by a maze of codes. ! Check on individual nodes as well as the entire form can be done to find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.(thus avoiding hop-chop way of debugging lay-out sets, that we used to do in the case of SAPscripts) ! Graphics can be included in Smart Forms, which can be displayed either as part of the form or as background graphics. Background graphics can be used to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, if desired, the background graphic can be suppressed. ! SAP Smart Forms also support postage optimizing. (I haven't yet gone deeper in to this feature) Sounds interesting, right? The way in which all the above features are incorporated will be covered in following sections.
Page 7 of 7
Testing/Running Smart Forms: After, the Smart Form is created, it has to be activated, by which the function module for that smart form gets generated. The name of the function module generally has the following pattern, /1BCDWB/SF00000034. Name of the function module can be got from the menu path (in form builder screen), 'Environment->Function Module Name'.
Page 8 of 8
Form Attributes
The two basic nodes are 'Global Settings' and 'Pages and Windows'.
Page 9 of 9
Page 10 of 10
Standard Import
Exceptions:
Page 11 of 11
Types:
Page 12 of 12
Define types here, which can later be used inside 'initialization' or 'Global Data' or inside any 'program lines' node.
Field Symbols:
Initialization:
import/export parameters defined in form interface are to be passed explicitly as 'input parameters' for these to be visible inside 'INITIALIZATION'
All those parameters whose changed values (inside INITIALIZATION) have to be reflected in rest of the form
Page 13 of 13
Form Routines: Here, you define all your subroutines (for eg., conversion before output). These can be accessed from 'program lines' nodes.
Done with Global settings. Lets move onto the other major node of the tree structure, 'Pages and Windows'.
Page 14 of 14
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
Page 15 of 15
Tray of the printer from which papers for printing this page are to be taken
mostly, GRAPHIC
BMAP or TIFF
to expand the fields, so that, parameters can be used dynamically determined by mentioning the field e.g., &V CHROME&
Page 16 of 16
Now, we can define the page contents. For each page, the Form Painter shows an individual layout. Whether the page is included into the printout depends on whether it is evaluated during form processing (a page can be omitted even though it is part of the tree structure).
3.2 Windows
Creating a window:
This has to be opted for if the window is to be a main window. As in the SAPscripts, there exists only one MAIN window per Form.
Page 17 of 17
This has to be opted for, if you want a box to appear on the window
3.2.3 Conditions:
Within a Smart Form 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. You can determine a condition as logical expression using a table control. Each line of the table control consists of a field name, a comparison operator, and a comparison value. The comparison value can itself be a field name. As comparison operators, the ABAP operators =, <>, <, >, <=, >=, CP (contains pattern) and NP (not contains pattern) are allowed. All lines of the table control are linked with the logical AND. In addition, you can use a pushbutton of the table control to insert an OR link for comparisons. In the table control, it is displayed as line with gray background. The Check function checks whether all field names that appear in the comparisons are declared in the form interface or in the global data of the form. Above features can be referred to in the following screen shot.
Page 18 of 18
additional conditions like, node to be executed only in first page, etc can be mentioned here
Output Options and Conditions are the same for every node.
Page 19 of 19
4.1.1 Text
This node is used to print any texts (and table contents), except addresses. There are following text types: 1. Text Element (to enter new text in the PC editor) 2. Include Text (to include an existing SAPscript text) 3. Text Modules (to include a text module).The first two types are same as that were in SAPscripts. Parameters and system fields can be printed inside these text nodes. (this poperty deviates very little from that of SAPscripts in that only the system fields here are different). All the fields available inside the form can be seen, by setting Field List- On.
Page 20 of 20
System fields made available are listed under the node, SFSY. The fields can be referred to as, SFSY-DATE. Another interesting feature of including fields other than by the normal way (by clicking on + symbolled icon lying in the tool bar of a text node, and entering the field name between ampersands) is to simply drag the required field from the field list and drop them on the PC editor of the text node.
You can append the text directly to the output of the predecessor node or start it in a new paragraph or a new line.
Page 21 of 21
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
Features of Text Modules: Through text module maintenance function we can create and edit text modules. Similar to text nodes, text modules have the following characteristics: They can be used cross-client They are connected to the transport system They are connected to the translation tools in the system Fields can also be referred from a text module. But if those fields are not defined in the Smart Form which includes this text module, syntax error is raised.
Page 22 of 22
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.
Here, the Smart Style whose paragraph formats and character formats, you will be referring to inside the text module should be determined. SYSTEM is default Smart Style provided by SAP.
4.1.3 Graphic
You use the graphic node to display graphics, such as a company logo, on the form. This node is used the same way as the background picture for a page. Check out section 3.1.3. In SAPscripts, graphics were incorporated in a form by including a standard text containing TIFF image. As of Release 4.6, graphics are stored on a
Page 23 of 23
document server. In addition to *.TIF ,*.BMP files can also be imported and used in forms. Maintaining Graphics Graphic administration is used to import, administer, and transport graphics, and to display them in a print preview. You can either incorporate graphics statically into a form (for example, the company logo) or include them dynamically using an appropriate field (for example, material graphic showing the displayed material). This was also discussed in sec 3.1.3. The transaction for Graphic administration -> SE78.
To be opted for, if you desire to store the graphic in the printer memory;thus, if it occurs the second time in the same print request, graphic is taken from printer memory
Page 24 of 24
4.1.4 Address
Address node
This has to be given along with address number for personal address
Page 25 of 25
4.2.1 Template
This node is to be used for displaying a table whose layout and number of rows and columns is determined before run-time. The text nodes created as successors of this node actually hold the data to be printed. This node just defines the way, the successive text nodes have to be printed. Thus making the concept of defining tabs in paragraph formats redundant.
First, the table layout has to be defined. The pattern(no. of cells, width of each cell) of each row of table that is being printed is defined in the line types. In the above example, two line types are defined. L1 is applicable to rows from 1 to 3, and it has height of 1 cm, has 4 cells, each of varied length. Previous line type can be referred to in creating new line types.
Page 26 of 26
Table Painter: Table Painter graphically depicts the various line types, and here, the width, height of cells can adjusted.
Select Pattern: You can select the pattern in which the final table should be appearing( encasing each cell with in a box etc.,). Thus the concept of drawing frames and boxes which was followed in SAPscripts is redundant.
This displays the same set of patterns, but with a border around
Page 27 of 27
To actually display contents inside this table layout, text nodes have to be created under this template node, and these will be containing the data to be displayed. You can specify which text element is to be printed in which cell of which line type. In the following example, there are in all 3 lines of a table have to be printed. For that 3 line types are declared as follows,
Now, 10 text elements have been defined under this template node to which will be outputing data in 10 cells (of 3 lines) The output options of a text node defined under template node has extra fields for mentioning the line number and column number in which it has to be printed.
Line number
Group all the text nodes that belong to a particular line into a folder. This improves clarity and has no effect on functionality. The length of a line type should exactly be equal to the width of table/template.
Page 28 of 28
4.2.2 Table
Internal tables passed from driver program through form interface, can be printed using this node. Actually, internal table is looped at, with the data read into a work area (the internal table will not have a work area defined , if its not passed as a table; and passing internal tables as tables should be avoided, as we need only the values of that internal table, and if at all the internal table is changed inside the form, in most cases, those changes need not be reflected in the main driver program) ;this work area should have already been defined under global data. The concept of line types, table painter, select pattern remain same as that for node, 'Template'. Define Table Layout
If on the current page there is not enough space left, the text is displayed entirely on the next page.
Generally, if the internal table is to be displayed, all the rows will be having the same line type.
Page 29 of 29
specify range of line numbers; if left blank, loops through all rows
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
More about control breaks: For example, in the above 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
Page 30 of 30
tasks performed inside this event, like printing subtotals in a text elements (which have to be created as successors of this event).
Personnel Number 1 Emoluments 123 234 345 702 234
Total Salary 2
In the above example, 'Total Salary' and its value will be printed after a control break is encountered (when the value of PERNR changes). This subtotal can be calculated ( or any complex logic that has to be performed at control break can be incorporated ) inside a 'program lines' node as it would have been done in normal ABAP program. This 'program lines' node will obviously precede the text node in which the subtotal is being printed, and succeed the event node under discussion. Define Events (Header and Footer)
In a section, output of a header or footer can be determined using events. To do this, select a header and/or footer on the Events tab of the section node. In the form tree, the corresponding event node appears.
Page 31 of 31
You can display the header at the start of a section and/or after a page break, the footer before a page break and/or at the section end. For the footer, you must specify a height to tell the composer how much space to reserve for the footer. Footer, is generally used to display subtotals, since this area is processed only at the moment of the page break. Under the event node, you can append, for example, texts for the heading or footer line of a section .
4.2.3 Loop
The functionality of this node is almost same as that of a table in that , here also we loop at an internal table into a work area and print the fields of this work area; but it differs from 'Table' node in that, Line types can't be specified in this kind of node. you cannot specify the (table)format in which the table fields are to be printed.
Comparing this with 'Table' node, we can see that, 'Loop' node is bereft of the tab, 'Table', unlike 'Table' node. Rest all tabs are same as that of node, 'Table'.
Page 32 of 32
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
Page 33 of 33
4.2.5 Alternative
This node helps in applying IF-ELSE logic in the form. As it is apparent, the successor nodes of TRUE are executed if the condition is satisfied, else the successor nodes of FALSE are processed. The way, the conditions are to be defined is same as that is being done under a 'conditions' tab of any kind of node. (Refer to sec. 3.2.3 )
Page 34 of 34
4.2.6 Command
This node can be used to change spool settings/trigger new page/change parahgraph setting/setting printer control.
Print controls are general print control statements that can be embedded into texts as formatting commands (for example, to change a character font size).
Page 35 of 35
4.2.8 Folder
This node can be used to group all similar nodes (those serving same purpose) into a single unit, called 'folder'. This node doesn't have any effect on the form logic. Its utility is just for the sake of increasing clarity. Its useful in grouping successor nodes of Template/Table/Complex Section. (Refer to sec. 4.2.1 Template, where this was used)
Page 36 of 36
Style Builder has three basic nodes, Header Data, Paragraph Formats, Character Formats.
Page 37 of 37
Page 38 of 38
Page 39 of 39
Epilogue
This document is not consummate in itself and awaits a further version, which will be covering the following features of Smart Forms, that could not have been covered here.
Page 40 of 40
Style Builder If I have missed anything other than the above, please let me know. I would also like to hear from you regarding any improvements that can be made in the present document, and they will duly be incorporated in the new additions. - TCV.
Page 41 of 41