Sei sulla pagina 1di 37

SAP Smart forms

by Yashbir Singh/Krishna Prasad

Objective Introduction Getting started Tools Form Builder Node Types Smart Styles Text Module Integrating the Smart Form into the Application

Excersise
Looking Forward

FAQs

Objective
At the conclusion of this course, you will be able to: Create and change SAP Smart Forms using the SAP Form Builder and its tools. Create and change styles for forms using the Style Builder. Explain how forms are implemented technically and how they are integrated into application programs.

Introduction
SAP Smart Forms are used to create and maintain forms for mass printing in SAP Systems. As output medium SAP Smart Forms support a printer, a fax, e-mail, or the Internet (by using the generated XML output). Document Creation tool. Smart Forms are used in SAP to create and maintain forms for mass printing. Examples of mass printing are monthly invoices sent by telecom companies or salary statements. The output of application data is placed into a dynamically expandable table where the size and layout of the output table is determined by the number of records being retrieved. 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 MM, SD, FI, and HR of the R/3 Release.

Advantages
The Smart Forms offers the following advantages: 1. Creating and maintaining forms require half the time. SAP Smart Forms allow 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 and in remaining cases, only rudimentary ABAP skills are enough to see us through.Thus, a power user without any programming knowledge can configure forms with data from an SAP System for the relevant business processes.. 2. 3. 4. Adapting to forms without any programming techniques due to GUI. Web publishing using the generated XML output. High performance when printing in large quantities Since SAP Smart Forms are directly integrated into the applications, no time is lost due to data exchange with external systems.

Advantages
5. Displaying table structures (dynamic framing of texts) 6. Output of background graphics, for form design in particular the use of templates which were scanned. 7. Colored output of texts 8. User-friendly and integrated Form Painter for the graphical design of forms 9. Graphical Table Painter for drawing tables 10. Reusing Font and paragraph formats in forms (Smart Styles) 11. Flexible reuse of text modules 12. HTML output of forms 13. Interactive Web forms with input fields, pushbuttons, radio buttons, etc

SAP Smart Form Architecture

Smart Forms has three driving components; Print Program Layout Set Function Module

Getting Started
When creating a form, you must: Retrieve the application data

Describe your form


Pass the application data to the form

Tools

SAP Smart Form Builder

Transaction Codes : SMARTFORMS SMARTSTYLES

Form Builder

Three areas in Form Builder: Navigation tree, Maintenance screen and Form Painter.

Node Types: Overview


When you create a Smart Form, the tree structure of the Form Painter already contains two root nodes:

You use the successors of the Global Settings node to maintain Form attributes, the Form interface, and Global definitions.
You use the successors of the Pages and windows node to create the pages of your form, position elements on these pages, and determine the sequence in which you want to process these elements. Apart from the two root nodes, each node has attributes. You can maintain these attributes on tabs on the right half of the screen. The attributes you can maintain on the tabs General Attributes, Output Options, and Conditions are the same for most of the node types.

Successors of Node Pages and windows


As direct successors to root node Pages and windows you can create only page nodes. The tables below describe these page nodes and the other successors:

Smart Styles
Use In a Smart Style you define the paragraph and character formats, which you can then assign to texts and fields in the Smart Form. You maintain a Smart Style in the Style Builder. You must assign a Smart Style to each Smart Form. You do this globally for the entire Smart Form in the form attributes. In addition, you can assign a Smart Style locally to a node, for example, a text node. This assignment then applies for the entire subtree and overrules the global settings. Features A Smart Style contains: Header data containing the default values of a Smart Style Paragraph formats including indents and spacing, font attributes, tabs, and outline and numbering Character formats including effects (superscript, subscript), barcode and font attributes Colors and underlines for a paragraph or character format You can convert an existing SAPscript style into a Smart Style

Smart Styles Activities


Choose transaction SMARTSTYLES. The initial Smart Styles screen appears.

Enter the style name.


To create a Smart Style choose Create. To activate an existing Smart Style choose Activate. Before you can use a Smart Style in a Smart Form and transport it, you must activate it. During the activation the system checks the Smart Style for errors and, if it detects any, displays an error list.

Text Module
Use You use text modules to centrally store texts in the system that you frequently use in forms. This detaches the text maintenance from the form maintenance so that you need not call the Form Builder to edit individual texts.

Integration
You include text modules into forms using text nodes. The text node can either refer to the text module or copy its text. In the latter case you can change or enhance the text according to the requirements of the form. Features SAP Smart Forms provide a text module maintenance function that allows you to 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 Due to the latter characteristic the logon language uniquely assigns a text module to a language.

Text Module
SAP Smart Forms include only text modules of language A into forms of language A. The language of a form is equally determined by the logon language. Activities

To maintain a text module, call the SAP Smart Forms initial screen.
Check the data on the Administration tab. View Language attributes on this tab to see in which language the text module is created. On this tab, you also set the style to be used and other parameters for translation.

Use the PC Editor on the Text tab to enter your text.


After you have saved your text, you can include the text module into a form.

Integrating the Smart Form into the Application


Use You trigger form printing by calling only two function modules. The first module uses the name of the form to determine the name of the generated function module. Then you call this module.

The name of the generated function module is unique only within one system. Therefore, you must always call the function module first that uses the form name to determine the current name of the generated module.
Prerequisites You defined the form interface in your form and activated the form.

Procedure
1. 2. In the Form Builder call the function Environment Name of the function module and use STRG-Y and STRG-C to copy its name. In the data retrieval program define a variable of type rs38l-name for the name of the generated function module: data fm_name type rs38l-name.

You can call the Smart Form in other parts of the application program as well. However, in this case you must make sure that the system can access the data to be passed from that place. We recommend to encapsulate the data retrieval in a function module as well. 3. If desired, you can call the function module SSF_FIELD_LIST. It returns a list of the form parameters actually used in the form. You can use this information to limit data selection, if necessary.

4.

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 EXCEPTIONS NO_FORM =1 = fm_name

NO_FUNCTION_MODULE = 2 OTHERS IF SY-SUBRC <> 0. <error handling> ENDIF. = 3.

5. Call the generated function module.


CALL FUNCTION fm_name EXPORTING * ARCHIVE_INDEX * ARCHIVE_PARAMETERS * CONTROL_PARAMETERS * OUTPUT_OPTIONS * USER_SETTINGS G_CARRID G_CONNID * IMPORTING * JOB_OUTPUT_INFO * JOB_OUTPUT_OPTIONS = = = = 'X' = <variable> = <variable> = = =

TABLES
GT_SBOOK EXCEPTIONS FORMATTING_ERROR INTERNAL_ERROR =1 =2 = <internal table>

SEND_ERROR
OTHERS IF SY-SUBRC <> 0. <error handling> ENDIF.

=3
= 5.

Lets do Some Exercise now

SAP Smart Forms: Output Type


You can select one of the following: Standard Output during form processing, the output data is generated in OTF format.

XSF Output during form processing, the output data is generated in XSF format. XSF is an XML-based language that is determined in the SAP Smart Forms DTD. (for the definition refer to BSP page /bc/bsp/sap/smart_forms/smart_forms_xsf.dtd)
XSF Output + HTML during form processing, the output data is generated in XSF format as well as any HTML data which the application can send to the browser for display.

Global Form Routines


If you have code to be used in different program lines nodes it makes sense to move this code into global subroutines (forms) and then call these as required. You create subroutines in the editor of the Form routines tab of the Global definitions. The syntax is normal ABAP syntax. You define the routines using FORM <form> [TABLES ...] [USING ...] [CHANGING ...]. You also use normal ABAP syntax to call a defined form using perform <form>. For more information refer to the ABAP documentation. Subroutines that you create in program lines are only known there and cannot be used in other program lines.

Command Node
Go to new page: A page break normally occurs if the main window of a page is full.

Reset paragraph numbering: If you enter an outline paragraph here (which must exist in the style used), the numbering of this paragraph and all associated paragraphs at lower-level outline depths is reset to initial. Paragraph formats without outline attributes are ignored. See Unit 9 - Smart Styles.

Include printer control: Here you can send a print control to the output device. This allows you to use special features of your printer. Print controls are managed in spool administration and are converted into printer-specific escape sequences during output. See Unit 10 - Fonts and Bar Codes. You can also define free attributes for the spool request with values of your choice. These can be evaluated using table TSP02A.

Page Attributes

Text Nodes - Attributes

Text Nodes - Attributes

Text Module

Include Text

Tables and Templates

Tables

- Sorting and Control Levels

Tables

- Sorting and Control Levels


You can use the second table control of the Data tab to sort the table output by fields of the internal table. The sequence in which you enter the field names into the table control determines the sorting sequence. To change it later, you can use the black arrows above the control. Use the rediobuttons to specify whether to sort the field in ascending or in descending order. For technical reasons Smart Forms cannot see whether the internal table was sorted before (for example, in the data retrieval program). If yes, you must still enter the sort sequence into the table control and mark already sorted. A control break results from the sort process whenever the value of a sorted field changes from one line to the other. The blocks in which the value of the field remains constant are control levels. If you want to display output before or after a control break, mark Event on sort begin or Event on sort end. Then in the tree structure an event node appears for which you can create successor nodes to display output at these events (for example, subtotals).

Complex Templates as background Pictures

Program Lines

Interface Parameters
The generated function module has both required and optional parameters: Required parameters: You have entered these in the SAP Form Builder. These are application data to be output or used for calculations in the form. Optional parameters. These exist for each form. They are not ready for input on the form interface tabs of the SAP Form Builder. They include: - control_parameters: General output control - output_options: Output options (see structure ssfcompop in the Dictionary) - user_settings: If set to 'X', the user defaults for spool control are used. Otherwise, the

output_options values for the printer, immediate output and spool retention period are evaluated.
- archive_index, archive_index_tab, archive_parameters: Parameters for archiving - mail_appl_obj, mail_recipient, mail_sender: Parameters of the Business Comunication Interface for sending forms as e-mails - document_output_info: Number of pages output (field tdfpages) - job_output_info, job_output_options: Structures with information on the output (for example, with XML output)

Interface Parameters
One of the most important parameters of the generated function module is control_parameters. The following fields are available: no_open and no_close: These parameters allow you to add several forms to a spool request. To

do this, set the parameters as follows:


- Firstcall: no_open = space, no_close = 'X'. - All subsequent calls: no_open = 'X', no_close = 'X'. - Last call: no_open = 'X', no_close = space. device: Output device ('PRINTER', 'TELEFAX', 'MAIL'). The default value is 'PRINTER'. no_dialog: No dialog box for output. preview: Print preview langu: Language in which you want to print the form replangu1, replangu2, replangu3: Alternative languages if the form does not exist in langu startpage: Start page other than the top page in the navigation tree of the SAP Form Builder getotf: No printout, display or faxing, but OTF (Output Text Format) output to the table job_output_info-otfdata.

FAQs
How different are Smart forms from SAP Script? Can we migrate existing SAP scripts into SAP smart forms?

What is the advantages of using Smart Forms over SAP Scripts?

Potrebbero piacerti anche