Upload
sameer-kumar
View
68
Download
1
Tags:
Embed Size (px)
Citation preview
Smart Forms
Introduction
General Concepts on Form Printing
Structure of a Form
Pages of a Form
Main Window and Subwindows
Texts and Data in a Form
Overview
Architecture
Creating Forms Using SAP Smart Forms
Retrieving Application Data
Describing a Form
Form Logic: Introduction
Example for Form Logic
Using SAP Smart Forms
Graphical User Interface
Node Types: Overview
Shared Attributes of the Node Types
Basic Elements of a Form
Creating Pages
Creating Windows
Positioning of Texts on the Form
Entering Texts in the PC Editor
Including Text Modules
Including SAPscript Texts
Web Attributes
Using Simple Input Types
Using Group Input Types
Using Text Areas
Inserting Addresses
Printing Graphics
Combining Nodes
Using Parameters in a Form
Passing Data to the Form
Defining the Form Interface
Integrating the Smart Form into the Application
Global Definitions
Using Fields in the Form
Including Fields in the PC Editor
System Fields
Field Syntax
Output Options for Field Contents
Displaying Fields That Refer to Currencies or Quantities
Printing Data in a Table
Line Types
Line Types for Templates
Line Types for Tables
Printing Templates
Describing the Table Layout
Displaying Contents in Cells
Displaying Graphics in Templates
Displaying a Background Picture for Copy Purposes
Combining Templates and Windows
Printing Tables
Accessing Application Data
Reading Internal Tables
Sort Criteria
Combining Loops and Tables
Specifying Table Output
Output Areas of a Table
Page Protection for Tables
Calculations
Examples
Calculating Grand Totals
Calculating Subtotals
Numbering Table Items Consecutively
Calculation and Initialization Events
Operations
Calculations on All Items of the Table
Calculations on Items of a Sort Level
Calculations at Sort Level Break
Printing Old Tables
Table Tab
Data Tab
Events Tab
Determining Table Contents
Flow Control
Determining Output Conditions
Events
Branching Within the Form
Processing Output Repeatedly
Page Sequence and Numbering
Dynamic Page Break
Page Numbering
Maintaining Forms With the Form Builder
Navigation Tree
Copies and Links in the Navigation Tree
Form Painter
PC Editor
Table Painter
Defining Line Types
Boxes and Shadings
Setting Boxes
Setting Shadings
Context Menu
Keyboard Commands
Checking and Testing a Smart Form
Field List and Error List
Undo / Redo
Downloading and Uploading Forms
Output Options
Box and Shading
Preview
Maintenance of Styles with the Style Builder
Smart Styles
Header Data of a Smart Style
Paragraph Formats
Character Formats
Maintenance of Text Modules
Form Output
Output Formats
Output in OTF Format (Standard Output)
Output in PDF Format
Output in XSF Format
Statically Activating XSF Output
Dynamically Activating XSF Output
Output in HTML Format
Output in XDF Format
Output Example
Output Media
Spool Processing
Controlling the Spool Dialog
Printing Several Forms in One Print Request
Output of XML Documents
Sending Forms by E-Mail or Telefax
Archiving
Returning a Form as a Table in the Application Program
Smart Form Trace
Activating and Configuring the Trace
Analyzing Trace Output
Administration of Form Graphics
Importing Graphics
Graphic Information and Preview
Transporting Graphics
Advanced Form Development
Special Node Types
Commands
Complex Section
Program Lines
Processing a Form
Output Control: Overview
Processing Pages
Processing Windows
Main Window
Copies Window
Final Window
Processing Loops and Tables
Summary
Summing Up Different Currencies
Calculating and Printing Grand Totals
Calculating and Printing Subtotals
Delivery and Translation
Parameters of the Generated Function Module
Default Settings (Standard Output)
Control Structure
Output Options
Options for Fax Output
Spool Settings
Options for XML/HTML Output
Querying the Output Result
XML/HTML Output Structure
Forms in Internet Applications
Input Elements
Simple Input Types
Group Input Types
Text Areas
Digression: HTML Forms
Integration into BSP Applications
Evaluating Form Input
Integration in IACs (ITS Technology)
URL Access to Smart Forms Objects
Migrating SAPscript Forms
Migrating Smart Forms
Notes About Migrating Smart Forms
Migrating BDS Graphics into the MIME Repository
Smart Forms
PurposeYou use Smart Forms to create and maintain forms for mass printing in SAP systems. Besides using the printer for standard output you can also select the Internet (by using a generated HTML output), a fax, or e-mail as the output medium.
In addition to the tool, SAP delivers a selection of forms for central business processes. This includes forms in Customer Relationship Management (CRM) as well as in the applications SD, FI, and HR.
Smart Forms offers the following advantages:
Creating and maintaining forms requiring half the time
Adapting forms without any programming knowledge due to entirely graphical user interface
Integrating input elements into the HTML output, which enables you to use a form in Internet applications as well
Smart Forms replace SAPscript forms. SAPscript forms will still be supported in the future; you can use them without making any changes for years to come. You can even use SAPscript texts in the Smart Forms. Migration of SAPscript forms into Smart Forms is supported.
IntegrationSmart Forms allows you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a user who is familiar with the tool but has only rudimentary programming knowledge can configure forms with data from an SAP system for the relevant business processes. The result of the form development is a Smart Form. After it is activated, the Smart Form is similar to a callable function module in the SAP system.
The logic of the form is mapped entirely in the Smart Form. To print a form, you call it from within an application program, in which you retrieve the application data to be merged into the form. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form.
Features
ToolsTo develop a Smart Form you use the Form Builder in which you describe the attributes of the Smart Form by using the integrated graphical tools, such as the Form Painter for the layout of a form page or the Table Painter for the design of table output. The form logic is represented by a hierarchy structure (tree structure) that you construct of individual nodes together with the relevant attributes. Besides using existing nodes for global settings you may create, for example, nodes for the output of texts, of tables, or of graphics. To make changes, use Drag&Drop, Copy&Paste, and select different attributes. These actions do not require writing coding lines or using a Script language.
You can check individual nodes as well as the entire form and 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.
TablesYou can include static and dynamic tables into a Smart Form. Dynamic tables enable you to display tables whose size is determined only at the moment of their output by the number of the table items to be displayed. Table functions are:
Line feeds in individual table cells
Event-controlled output of table headings and footers
Integrated calculation of grand totals and subtotals
Colored boxes and shadings in tables
MiscellaneousTo position output on a form page you use windows. Besides using simple windows for displaying output of fixed length there are special window types, for example, for continuous text or for distinctions between the original and a copy of a form.
You can include background pictures as graphics, which you can either use as copy templates for a form or print as background graphics.
You can specify spool attributes in the form to allow for postage optimizing.
Interactive Web FormsYou use HTML output to integrate forms into Internet applications. This allows you to use the same Smart Form both for printing and for the Internet application. The layout of the form in the web browser corresponds to the print layout.
You can enhance the web forms with input-enabled elements, allowing the recipient or user of a web form to change or supplement data. The data the user entered can either be queried by the Internet application or be evaluated automatically by the system.
Introduction
Depending on your knowledge, you may be able to skip certain parts of the documentation. This section tells you about the units in this documentation and what they contain so that you can select the parts you need. The documentation consists of these parts:
1. The introductory part. It first describes general concepts on form printing (independent of the tool you use). If you already developed forms on a PC, you can skip this part or refer to special sections of it, if required. Then, the Overview gives a bird's eye view of form development using SAP Smart Forms. Don't miss this part, because it is essential for understanding the basics of SAP Smart Forms.
2. The practical part. Using SAP Smart Forms explains how you use nodes to describe your form output. Starting with the simple node types, the end of this part is dedicated to more complex output, for example, in tables, which requires insight into the relevant concepts. After reading about the Basic Elements of a Form you should start to actually work with the SAP Smart Forms user interface. You will easily familiarize with it. Then, if required, you can resume reading about the more complex features.
For practizing, take a look at the example forms in the system. They have the name
prefix SF_EXAMPLE_ . In the ABAP Editor (transaction SE38 ), you can use a program with the same name to call these forms.
3. The descriptive part. It describes the tools for maintaining forms in the Form Builder, for maintaining styles in the Style Builder and for maintaining text modules. You may have found out already many of the functions described there, but maybe you are still searching for the keyboard command you can use in the Table Painter to select several table cells in one go?
4. The form output part. It introduces you to all the things you can do with your form once it is completed. Appended to the basic features you find information on how to administer form graphics.
5. The advanced form development part. It requires programming skills. The sections describe the behavior of Smart Forms in detail and contain information for application programmers.
6. The web forms for Internet applications part. It leaves classical form printing and explains how to integrate HTML output of SAP Smart Forms into Internet applications. We recommend that you do not use this part as a starter unless you must integrate the form of a colleague into an Internet application.
General Concepts on Form Printing Form printing covers creating and maintaining a form for mass printing in SAP systems. This includes design and layout of the form as well as form logic.
The layout determines the page structure, that is the number of differently structured pages and the positions of the output areas on these pages. Within the output areas, you use tables, paragraphs, paragraph formats and character formats to structure and format texts and data.
The form logic controls the dynamic formatting of the form. It allows you to display variable fields, to display texts only if a certain condition is true (for first dunning, use this text, for second dunning, use another), or to repeatedly process invoice items within a table.
Forms can be:
Order confirmations
Invoices
Account statements
Checks
Salary statements
Delivery notes
Customs forms
Industry-specific forms, such as quality forms in the automotive industry
The concepts on form printing presented below are independent of any tool. As of mySAP.com Release 4.6C, use SAP Smart Forms in the SAP system.
This documentation does not cover document output and control on printers. The description of the process ends with the transfer of a processed file to the output
management, which is the spool in the SAP system (see also SAP Printing Guide (BC-CCM-PRN)).
Structure of a Form
Definition
A form consists of pages, output areas, addresses, graphics (such as company logo), and data or text contents. Within an output area, you can use static or dynamic tables to display data or texts in lines, columns, or cells. To further structure and format text and data, use paragraphs with the paragraph and character formats.
SAP calls output areas "windows". You can position windows freely on a page (see also Pages of a Form and Main Windows and Secondary Windows).
Example of a Form Structure
We use a simple invoice in which the flight bookings of certain customers are displayed with prices in a table in a window. The invoice also contains other windows for the company logo, the sender address, the customer address, company-specific data (clerk, customer number, reference, date, and so on), bank data, and pagination.
The first page displays the customer letter, followed by a table containing the flight bookings of that customer. The output length of the table depends on the number of booking items (dynamic table). The table header contains the column headings, the table footer contains the total. If the space on the first page is not sufficient to take all items, the table continues on the next page, thereby repeating the column headings. In addition, the first page contains:
The company logo inserted as graphic in bitmap format. The customer address. This address appears only on the first page (for the window in the
envelope) and is preceded by the sender address in small font. A window containing company-related data in several fonts and font sizes (invoice, clerk,
phone/fax, reference, customer number, date). The footer containing the company and bank data.
The second page contains the current page number and the total number of pages in the document.
Pages of a Form
Definition
On the pages of a form you determine the page layout and the sequence of pages with different structures. If makes sense to distinguish between draft pagesand print pages:
You use a draft page to determine the layout and the contents of one or several print pages. In SAP Smart Forms, you use the Form Builder to define draft pages.
Print pages are those pages that are eventually printed.
The page layout includes the page format (for example, DIN A4, Letter, DIN A5 landscape) and the position of the windows on a page.
Use
The individual pages of a form differ in their structure. The first page of an invoice, for example, contains an address, which you do not want to display on the next page; and you may want to display the General Terms of Business on the last page. You determine this structure using draft pages. For each draft page, you must specify a next page to make the page sequence clear. You can also repeatedly call the same draft page if you want recursive output.
Example
Many forms contain only two pages of different structure, for example one for the letter and one for listing the invoice items. For such a form you need two draft pages; the second page, which is defined as next page of the first one, calls itself as next page. If the text does not entirely fit onto the second print page, another print page with identical structure is started automatically. The diagram below illustrates this example:
For draft page 2 the question arises when to start printing a new page, that is, when to trigger a page break. The page break is triggered either automatically by the main window (see also Main Window and Secondary Windows) or built into the form logic (see also Determining the Page Sequence).
Main Window and Secondary Windows
Definition
On a page, there are two different types of output areas for texts and data: the main window and the secondary window.
Use
You can position windows anywhere on a page, even overlapping. You can position the same window (determined by the technical name, see also Creating Windows) on several pages of a form, so that the same contents are displayed on all these pages. You can choose a different size for the window on each page, except for the main window.
Main Window
In a main window you display text and data, which can cover several pages (flow text). As soon as a main window is completely filled with text and data, the system continues displaying the text in the main window of the next page. It automatically triggers the page break.
You can define only one window in a form as main window.
The main window must have the same width on each page, but can differ in height.
A page without main window must not call itself as next page, since this would trigger an endless loop. In such a case, the system automatically terminates after three pages.
Secondary Windows
In a secondary window you display text and data in a predetermined output area. There is no flow text display with page break. If you position a secondary window with the same name on several pages, the system displays the contents of this secondary window on each page.
Text and data that do not fit into the secondary window are truncated and not displayed.
Texts and Data in a Form
Definition
You enter text in an editor (see also Positioning Texts on the Form).
Data can be character strings or numbers. The system reads this data from a database and uses fields (parameters) to dynamically display it (see also Using Parameters in a Form).
Use
To display texts and data in table format (for example, lists or invoice items), you use tables or templates (see also: Displaying Table Data).
To format texts and fields (data), you use paragraph and character formats. You assign paragraph formats to entire paragraphs and character formats to individual character strings, for example, to highlight a word.
The paragraph format determines:
Font family and font size, Indents and spacing, Text alignment within the paragraph, Tabs, Outline options, such as numbering, Protection of paragraphs against page breaks.
To determine the paragraph and character formats, use the Smart Styles (see also Smart Styles).
Overview
This section describes the architecture of SAP Smart Forms and how to create a form. Essential for creating forms is to understand the form logic.
Architecture
When you create forms for an application, you want to include application data into the form. The architecture of SAP Smart Forms separates application data retrieval from the actual definition of the form:
In a Smart Form you describe:
The layout of your form (element positions on a page) Individual elements you want to display (text, graphics, addresses, tables, and so on) the form logic you use, for example, to read application data from internal tables, to introduce
conditions, and to control process flows (see also: Form Logic: Introduction) a form interface to transfer application data to the form definition
When you activate the Smart Form, the system generates a function module that encapsulates all attributes of the Smart Form. As soon as the application program calls the function module, the Smart Form uses the module's interface (which corresponds to the form interface) to transfer any table data previously selected and to print the form according to the form description. This is also referred to as 'calling a Smart Form for printing'.
The form description can also contain statements that select further data during form processing. However, you should not use this method of data retrieval. Especially if you print mass forms, performance will deteriorate considerably.
A special characteristic of SAP Smart Forms is that application data can be merged with the form. Independent of the amount of data, you can print data as tables on the form. Thus, one Smart Form describes a set of forms that are created through calls with different application data. One call of a Smart Form always corresponds to printing one form.
Creating Forms Using SAP Smart Forms
This section gives an overview of how to create a form in which to display application data from database tables.
For more detailed information on this procedure, see Using SAP Smart Forms.
When creating a form, you must:
1. Retrieve the application data.
2. Describe your form.
3. Pass the application data to the form.
Printing the Form
Call a function module generated by SAP Smart Forms to print your form. SAP Smart Forms supports the following output options:
The form is printed on a printer connected to the SAP System. Before printing, use the print preview to check whether the form is correct.
The function module generates an XSF data stream that transfers, for example, the form description including the retrieved data to programs of third-party companies.
See also: Form Output.
Retrieving Application Data
Prerequisites
To achieve a good performance when printing a form, you must separate data selection from the use of data in the form. Thus you can bundle database operations before you start processing the form.
Before you retrieve data, you should know:
Which application data you want to appear in the form
Which database tables you must access to retrieve this data
Process Flow
Write an ABAP program to retrieve data or include a retrieval routine into your application. This code consists of statements that select data from the database according to certain selection criteria. Store the retrieved data in internal tables, structures, or variables and transfer it to the form in one step.
While you initialize the form, you can format the data, which you passed to the form, for output in the form. Formatting data in the form and not in the application program allows you to use one application program for several forms with different formatting routines.
Result
You store the application data in internal tables of the application program. Since you know now which table types occur, you can define a form interface to transfer this data to the appropriate form.
Describing a Form
You describe a form using a Smart Form. To do this, use the Form Builder (see also: Graphical User Interface):
1. Describe the interface of the form. It results from the application data previously selected.2. Create one or more pages. On a page, you can position windows, addresses, and graphics.
Within a window, you can create additional elements.3. Create elements (text, graphics, tables, and so on) for each page, using other tools of the Form
Builder:
o Use the Form Painter to position windows, graphics, and addresses on a page (the other elements are displayed in an assigned window).
o Use the PC Editor to write your texts.o Use the Table Painter to format your tables.
For an overview of the elements available on page level, see Node Types: Overview.
4. Use the flow control to control whether and when to print pages and elements.
Result
When you activate your Smart Form, the Form Builder generates a function module that encapsulates the form description.
Form Logic: Introduction
In the Form Builder you describe a Smart Form by a set of nodes. To do this, you build up a tree structure on the left side of the user interface:
This graphic already contains some nodes. The node Global Settings as well as its three inferior nodes Form Attributes, Form Interface, and Global Definitionsalways exist for any newly created forms. To describe the Form Logic, create a hierarchy under the node Pages and Windows. This hierarchy determines the rules used to process the nodes of the tree. Depending on the node type, this could include:
printing the node contents (text, addresses, graphics). executing the node statements. executing the inferior nodes of a node according to other rules (for example, in a loop).
You use the form logic to control the flow of the form output. The following rules apply throughout:
1. The nodes in the tree structure are processed from top to bottom. This is easier to understand, if you imagine all nodes to be expanded.
2. For each node there is a tab page, which you can use to link the node to a condition. If the condition is true, the system processes the node. If not, it skips the node and all its inferior nodes.
3. You must define a next page for each page. However, you can also go to other pages dynamically (see also: Flow Control).
In addition, the page break depends on how much space is left on the current page.
For the complete rules for processing the tree structure, see Rules for Processing a Form.
Example for Form Logic
The diagram below shows the tree structure of the root node Pages and Windows:
The numbering of the nodes also shows the sequence in which they are processed (from top to bottom). The first node is the root node. The inferior nodes of a node are all nodes included directly under this node in the hierarchy. For node 5 these are the nodes 6 to 9 (directly inferior nodes are only the nodes of the next hierarchy level, that is 6, 7, and 9).
A node without an inferior node is also called elementary node. Elementary nodes can never have inferior nodes (see also Node Types: Overview). If the condition of node 7 is false, neither node 7 nor node 8 are processed. Processing resumes directly with node 9.
In this example, we assume that no pages are called dynamically and that there is enough space on the page for the output.
Using SAP Smart Forms