Upload
msreddym5490
View
321
Download
19
Tags:
Embed Size (px)
Citation preview
1
SAP SMART FORMS
BY
SANGEETHA MOHAN
AUG 19,2002
2
•Smartforms Basics
•Smartforms and SAPscripts
•Demo
Overview
3
Forms can be:Order Confirmations
Invoices
Account Statements
Checks
Salary Statements
Delivery notes
Custom forms
General Concepts on Form Painting
4
Smart Form
Data retrieval Form logic Output device
Applicationprogram
Database
ABAPFunctionmodule
(generated)
Web Browser
Printer
Fax
SMART FORMS - ARCHITECTURE
5
SMARTFORMS Builder Components
1. Form Builder
The three frames of Forms builder screen are the :
Navigation menu
Maintenance frame
Form Painter frame
2. SMARTFORM Print Form template
A Smart Form print form is designed using the Smart form Builder.This form does not create the final
output . The Smart Form function module , generated by Smart Form print form creates the output.
3. SMARTFORM Function module
The Smart Form function module is the code generated automatically when activating the Smart Form
print form. Each time a change is made in the print form in the form builder ,the change needs to be
activated in the form builder before taking effect in the output.
4. SMARTFORM Print Program
The Smart Form print program is where the majority of data extraction occurs.Typically one Smart Form
print program should be associated with one type of form.
6
CSC Proprietary 04/08/23 05:41 PM 008_fmt_wht 6
SMART FORM Form Builder
Navigation tree Form Painter
Selected node
Maintenance frame
7
CSC Proprietary 04/08/23 05:41 PM 008_fmt_wht 7
Control Flow and Conditions
Control flow Nodes with condition(s)
are marked
Condition must be metbefore node is processed
8
Nodes - Overview
Output areasNode type Description
Page A page of the form.Window Output area on a page. There are main windows and subwindows.
Elementary nodes (without successors)Node type Description
Text To print any texts .Graphic To position graphics in the form.Address To include an address. The system reads the address data directly from
the database tables and formats them for print output.
Table outputNode type Description
Template Output of a table containing static dataTable Output of a table containing application data
Flow controlNode type Description
Command Executes special commands (next page, paragraph numbering, printercontrol)
Loop Processes successor node repeatedly.Alternative Branches depending on condition.
Other nodesNode type Description
Folder Combines successor nodes to logical groupsProgram lines Executes ABAP CodeComplex section Combines all attributes of the node types template, table, loop, folder
9
Attributes of the Node Types
General AttributesShows contents or description of the node
Output options
Contains attributes such as position, style, box and shading
Conditions
Allows to display the node only if
certain conditions are true
10
Pages and Windows
11
Pages and Windows
SMART Forms consists of one or more pages. The first page in the tree structure is the start page (when we create a form, the start page already exists).
Windows are output areas for all output data.. After we created a form, a main window already exists on the first page.
12
PC Editor is used to enter and format texts and fields
PC Editor
13
Texts and Fields - Concepts
For text output a text node is used
Three text typesText elements (locally in form)Text modules (for reusing texts)Include texts (for including SAP script texts)
No commands in text nodesBesides text only fields are allowedSAP script commands in Include texts are ignored
Fields are global variables of a formInterface parameters: Data transferred from application programGlobal data: Additionally required variables (e.g. for work areas)System fields: For special purposes (e.g. date, page number)
14
Texts and Fields - Field list and Inline Editor
Field List
Drag & Drop
15
Formatting options for fields
Syntax Description
&field+<offset>&Skips <offset> places of the field value (character fields only). If the offset is
greater than the length of the value, nothing is displayed.
&field(<length>)& Sets the output length to <length>.
&field(S)& Suppresses the sign
&field(<)& Displays the sign to the left of the number
&field(.<nat.number>)& Limits output of decimal places to <nat.number>
&field(E<nat.number>)&Displays the field value with the fixed exponent <nat.number>. The mantissa is
adapted to this exponent by shifting the decimal character and inserting zeros.
&field(T)&Suppresses thousand indicators when displaying fields of types DEC , CURR ,
INT , and QUAN .
&field(Z)& Suppresses leading zeros of numbers
&field(I)& Suppresses display of initial values
&field(K)& Deactivates a conversion routine specified in the Data Dictionary.
&field(R)&Right-justified display. Use this option only when specifying an output length as
well.
&field(F<filler>)& Replaces left-justified blanks in the value by the fill character <filler>.
&field(C)&
The system takes the field value as a sequence of words separated by blanks.
Option C shifts these words to the left and leaves only one blank inbetween as
separator. Any leading blanks are suppressed. This effect corresponds to that of
the ABAP statement CONDENSE.
16
System fields of Smartforms
Field name Description&SFSY-DATE& Displays the date according to the format in in the user master record.
&SFSY-TIME& Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE& Inserts the number of the current print page into the text. according to the
the format of the page number (for example, Arabic, numeric) in the page
node.
&SFSY-FORMPAGES& Displays the total number of pages for the currently processed form. This
allows to include texts such as ‘Page x of y’ into output.
&SFSY-JOBPAGES& Contains the total page number of all forms in the currently processed
print request.
&SFSY-WINDOWNAME& Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME& Contains the name of the current page (string in the Page field)
&SFSY-PAGEBREAK& Is set to ' X ' after a page break
&SFSY-MAINEND& Is set as soon as processing of the main window on the current page ends
&SFSY-EXCEPTION& Contains the name of the raised exception.
17
Table Output - Graphical Table Painter
Table node is used to pass any internal table data that is filled in the data retrieval program.
To display table contents, read each line of the table separately in a loop, then process and display it.
Tables nodes generally are created in the main window.
18
Paragraph and Character formats
A paragraph format contains information on indents, spacing, font settings, text color,
tabs, numbering and outline. Each paragraph format must have a unique name. In the PC
Editor, assign these formats to a text or a field .Alignment (default: left) Indent Spacing (default value for line spacing of the first line) Text flow
Page protection
Use this attribute to determine whether or not to display a paragraph completely on one page. Mark it
to avoid that a paragraph is split up by a page break. If on the current page (only in the main window)
there is not enough space left for the paragraph, the entire paragraph appears on the next page. Next paragraph
Use this attribute to link the subsequent paragraph to the current paragraph.
Character format is used to assign special output attributes to sections of texts or character
strings within a paragraph. For a character format, choose among the following attributes:Superscripting/subscripting the character string
Barcode Font attributes (font family, font size, bold/italic, underlined, color)
19
Paragraph and Character formats (contd….)
Paragraph and Character formats are created using transaction SMARTSTYLES
20
Processing a Form
Steps:-
Activate the smart form after the form design is completed.This activation will initiate the generation of a function module that handles all of the form’s processing.
In the data retrieval program(SE38) select all data that should be displayed in the form.After that the data retrieval program must call the generated function module to print the form.
Generated function module name of the Smart Form
An useful SAP function module for Smart Form driver program
SSF_FUNCTION_MODULE_NAME - It returns the name of the generated function module: This will help not to hard code the generated function module name.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'EXPORTINGFORMNAME = '<form name>'IMPORTINGFM_NAME = fm_nameEXCEPTIONSNO_FORM = 1NO_FUNCTION_MODULE = 2OTHERS = 3.IF SY-SUBRC <> 0.<error handling>ENDIF.
21
report ZDEMO2.parameter: p_form type tdsfname default 'ZSAN_SMART1'.data: customers type ty_customers , fm_name type rs38l_fnam* get data select * from scustom into table customers order by primary key.* print data call function 'SSF_FUNCTION_MODULE_NAME' exporting formname = p_form importing fm_name = fm_name exceptions no_form = 1 no_function_module = 2 others = 3. if sy-subrc <> 0.* error handling message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. exit. endif.* now call the generated function module call function fm_name exporting* archive_index =* archive_parameters =* control_parameters =* mail_appl_obj =* mail_recipient =* mail_sender =* output_options =* user_settings = 'X' customers = customers* importing document_output_info =* job_output_info =* job_output_options = exceptions formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 others = 5.if sy-subrc <> 0.* error handling message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif.
Data retrieval Program - sample code
22
SMART Forms and SAPSCRIPTS
Smart Forms SapScripts
Transaction : SMARTFORMS Transaction : SE71
Multiple Page format is possible Multiple page format is not possible
Main Window is optional Main window is mandatory
Routines and ABAP code can bewritten inside the smatforms tool .
ABAP code cannot be written insidethe SAPscript.
A function module is generatedwhen the Smart forms is activated.
No other object is generated whenSAPscript is activated.
23
Converting a SAPSCRIPT to SMARTFORM
ProcedureMigrating a SAP script form
Go to the SAP Smart Forms initial screen (transaction SMARTFORMS ). In the Form field enter the name of the Smart Form to create. Choose Utilities --> Migrate SAP script form.The dialog window Migrate SAP script Form appears. Enter the name and the language of the source form (SAP script). Choose Enter.This takes to the change mode of the SAP Form Builder. If the selected SAP script form does not exist in the selected language, a dialog window appears on which select one of the existing languages.Now change the design of the form and of the form logic. To activate the Smart Form choose Activate.
Converting a SAP script styleGo to the Smart Styles initial screen (transaction SMARTSTYLES ). In the Style name field enter the name of the Smart Style to create. Choose Smart Styles --> Convert SAP script style. Enter the name of the SAP script style to convert. Choose Enter.A list of the converted styles appears. Choose Back. Now change the Smart Style (Change).To activate the Smart Style choose Activate.
Mass Migration of SAP script FormsIn Reporting(SE38) select the program SF_MIGRATE and execute it. Select the names and the language of the SAP script forms and choose Execute. The system creates the Smart Forms under the names of the SAP script forms plus the extension _SF.It displays a list of the migrated forms. To change and adapt a form, go to transaction SMARTFORMS . Then activate the changed Smart Form.
24
What is next in forms?
SMARTFORMS
INTERACTIVE WEBFORMS (from ver 6.10 only)
SAPSCRIPTS
25
Interactive Webforms
Add additional fieldsfor input:
Add buttons to submitthe form:
26
Sources of Information
SAP Library in Help Portal (http://help.sap.com/)Basis (SAP Web Application Server)-> Basis-Services / Communication Interfaces (BC-SRV)
-> SAP Smart Forms (BC-SRV-SSF)
Example Smart forms and programs in our system(AS1)
SF_EXAMPLE_01 & SF_EXAMPLE_02
27
Questions/Comments