After completing this topic, you should be able to recognize how to print Smart Forms in a given scenario.
1. Features and benefits of Smart Forms
Smart Forms are an enhanced version of SAPscripts forms. Similar to SAPscripts forms, you can use Smart Forms to create and print documents, such as invoices and orders, in SAP. You can choose to migrate from SAPscript forms to Smart Forms.
You can print a Smart Form on a printer or generate an HTML document, a fax, or an e-mail message as output.
Smart Forms provide some important features:
- Interactive Web Forms
- Routines
- Smart Styles
- Tables
- Tools
- Windows
Interactive Web Forms
Web Forms are the HTML output of forms, which can be viewed on a web browser. Interactive Web Forms are forms with which you can interact using input elements. You can use interactive Web Forms to integrate Smart Forms with Internet applications.
Using interactive Web Forms in Internet applications can help you reduce the time needed to, for example, realize purchase orders.
For example, you send a link of your purchase order Web Form to a vendor. The vendor opens the Web Form and updates it with the total price. This process takes less time than the manual one does.
Routines
Routines are processing blocks within Smart Forms that you can use to perform processing tasks, such as calculating totals and subtotals based on a field.
Routines are reusable pieces of code. As a result, you can write a set of processing statements in a routine and use the routine any number of times from anywhere in the Smart Form.
Smart Styles
Smart Styles enable you to define paragraph and character formats. You can assign these formats to various text blocks and fields of a Smart Form.
You use Style Builder to create and maintain Smart Styles.
Unlike in SAPscripts, using Smart Styles enables you to separate styles from forms. As a result, you can define styles one time and use them across forms.
Assigning a Smart Style file to a Smart Form is mandatory. You can assign a Smart Style at two levels – form and element in the form. The style specified at an element level overrides the style specified at a form level.
For example, you assign a line spacing attribute with two points for the paragraphs in a form. At a text node, you assign a line spacing attribute with three points for the paragraphs. At this text node, paragraphs will use three points for line spacing.
Tables
You can use tables to format the output of a form into tabular format. You can use different functions of tables, such as:
- calculation of subtotals and totals within a table
- creation of table headers and footers based on events
- data input into each table cell
- table formatting, such as coloring and shading
You can create two types of tables.
In static tables, the length of the table remains constant. You specify the length in the relevant ABAP statement. You use this table type when you know the number of rows you want to display.
In dynamic tables, table length can vary and it is decided at runtime based on the number of rows to be displayed. You use this table type when you don't know the number of rows to be displayed in advance.
Tools
You use the graphical tools integrated with Form Builder to define the attributes of Smart Forms.
For example, you use the Form Painter tool to design the layout of a form page.
You use Form Builder to develop Smart Forms.
The graphical user interface (GUI) of Smart Forms displays the form logic in a tree structure. Each node of the tree structure represents an attribute of the form. You can use the default nodes to specify the global settings of a form. In addition, you can create your own nodes to define the attributes of form output.
Unlike SAPscripts, you can use the tree structure to make changes to attributes without using any scripting.
In addition, the tree structure helps you quickly find any error in a form.
Windows
Smart Forms provide windows to specify the format of a form output on the layout page of the form.
For example, you can use a window to place the vendor address in a purchase order form.
Unlike in SAPscript, in Smart Forms, windows are part of the form layout page. Creating or modifying windows and then adding them to SAPscript forms takes more time than creating and modifying windows on the form layout page of Smart Forms.
In Smart Forms, you can right-click the form layout page to add a window and drag the borders of the window to modify the size of the window.
There are two types of Windows:
You use simple windows to place output text of fixed length, such as report headers and footers, and vendor code in purchase order forms.
You use special types of windows when the output text is not of fixed length and you want to display the output text as a continuous chunk of text.
For example, the number of purchased items may vary in a purchase order. You need to use special windows to display details of purchase items.
The different features of Smart Forms – interactive Web Forms, routines, Smart Styles, tables, tools, and windows – enable quick and easy maintainence of forms.
The features of Smart Forms provide these benefits over SAPscript forms:
- easy maintenance
- support for Internet applications
- lower turnaround time
easy maintenance
Unlike SAPscript, Smart Forms contain a complete graphical user interface (GUI), which makes their maintenance easier. Almost all tasks in Smart Forms require no programming. Therefore, any person with minimal programming knowledge can maintain forms.
support for Internet applications
Smart Forms support Internet applications by enabling the generation of HTML output. Because of the Internet application support, users can access forms from outside an office network.
lower turnaround time
The extensively integrated graphical user interface (GUI) of Smart Forms results in less turnaround time for modifying forms and form logic.
Form elements and form logic are presented in a tree structure. You can select any node of the tree and modify the node on its attributes page.
Question
Match each feature of Smart Forms with the function it provides.
Options:
- Interactive Web Forms
- Routines
- Smart Styles
- Tools
- Windows
Targets:
- Calculate subtotals and totals
- Create paragraph formats
- Design a form layout
- Place a customer address in a sales order form
- Update purchase order forms
Answer
You can use routines to calculate subtotals and totals. Smart Styles enable you to create paragraph formats. Tools help you design a form layout. Windows enable you to place a customer address in a sales order form. Interactive Web Forms enable you to update purchase order forms.
You can use interactive Web Forms to view the HTML output of a form, such as a purchase order. Your vendors can access the purchase order and update it with data, such as the prices of the items ordered.
You can use routines, which are processing blocks, within Smart Forms to perform processing tasks, such as calculating totals and subtotals based on a field.
You can use Smart Styles to define the format in which text in Smart Forms can be displayed. You can define paragraphs and characters formats using Smart Styles.
Smart Forms provide GUI tools to define the attributes of a form. You can use the Form Painter tool to design the layout of a form page.
You can use windows to position output on a form page. You can add many windows on the layout page of a form and each window can contain some content of the form, such as the customer address in a sales order form.
2. Form processing in Smart Forms
When you create a form, you need to perform two activities:
- design the form
- retrieve application data into the form
The architecture of Smart Forms separates the application data retrieval task from the form designing task. You retrieve application data from within a report program, and you design a form using the interface of Smart Forms.
Designing a form involves four tasks:
- Create form layout
- Add elements
- Define form logic
- Create a form interface
Create form layout
In creating a form layout, you divide the total form area into different parts. In each part, you specify the positions of different elements.
Add elements
After creating the layout, you add the elements such as text, graphics, and tables you want to display in the form.
Define form logic
After you add the required elements to the form layout, you define form logic. In form logic, you write ABAP statements to retrieve application data from internal tables and to control the flow of form execution.
Create a form interface
After designing the form, you need to create a form interface. At runtime, the form interface transfers application data from internal tables to the form.
After designing a Smart Form, you can start using the form.
Question
Which statements are true about how Smart Forms process a form?
Options:
- 1. A report program executes a form using the form name 2. A report program provides data to a form 3. Smart Styles provide the layout of a form 4. The function module of a form prints the form
Answer
A report program provides data to a form, and the function module of a form prints the form.
Option 1 is incorrect. First you activate a Smart Form to generate a function module. Then in a report program, you use the name of the function module to execute the Smart Form.
Option 2 is correct. You use a report program to store data for a form. The function module of the form fetches data from the report program before printing the form.
Option 3 is incorrect. Form layouts are created using Smart Forms. Smart Styles don't provide form layouts. You use Smart Styles to create paragraph and character formats for use in forms.
Option 4 is correct. The function module of a form is the form interface to a report program. It encapsulates the entire functionality of a form. The function module retrieves data from a report program and prints the form.
3. Creating paragraph and character formats
Using Smart Styles, you can format text in Smart Forms. You use a paragraph format to format a paragraph in a form element, whereas you use a character format to format selected text within a paragraph in a form element.
When creating paragraph and character formats
- you first create a Smart Style that would contain the formats
- then you specify settings for the formats
- then you use the formats in a Smart Form
To start creating paragraph and character formats, you first open SAP Smart Form: Initial Screen using the transaction code "smartforms."
Using the SAP Smart Form: Initial Screen, you can create a Smart Style to create paragraph and character formats.
To create a Smart Style, you select the Style radio button, you type the Smart Style name – in this case ZStyle1 – in the text box associated with Style, you click Smart Styles - Create, and then you click Continue on Object Editing: Initial Screen.
Alternatively, you can press F5 to create the Smart Style.
You have created a Smart Style. Now you can create paragraph and character formats within this Smart Style.
Each paragraph and character format must have a unique name.
When creating paragraph formats, you can specify setting for
- Indents and Spacing
- Font
- Tabs
- Numbering and Outline
Indents and Spacing
In paragraph formats, you can specify the settings for indents and spacing. Indent settings include values defining the left and right margins. Spacing settings include values defining the space between two lines and the space before and after paragraphs. In addition, you can specify the alignment of the paragraph.
Font
You can specify the font face, style, and size of text in a paragraph. Font style includes text styles such as bold, italic, and underline, and color.
Tabs
In paragraph formats, you can set the tab space to specify the amount of space between two tab stops in a form.
Numbering and Outline
You use numbering and outline to specify formats for numbered paragraphs.
You can also specify the outline level of a paragraph format. For example, there are two paragraphs P1 and P2 with outline levels 1 and 2, respectively. You can use P1 for topic headings and P2 for section headings within a topic.
Suppose you want to create a paragraph format P1.
To create P1, you double-click Paragraph Formats, you click Edit - Create Node, you type P1 in the Paragraph Format dialog box, and then you click Enter.
Alternatively, to create a node, you can press F5.
You have now created the paragraph format P1.
After creating P1, you want it to have the "Justified" alignment. In addition, you want its left and right margins to be "2 centimeters" each.
To specify these settings, on the Indents and Spacing tabbed page, you select Justified from the Alignment drop-down list box, and then you type 2 in the Left Margin and Right Margin text boxes in the Indent section.
You have now specified the alignment and margin settings for the P1 paragraph format.
In addition to alignment and margins, you want to specify font settings for P1. You want the font family to be "Courier," the font size to be "10," and the font style to be "Italic."
To do this, you click the Font tab, you select Courier from the Font Family drop-down list box, you type 10 in the Font Size text box, and then you select Italic from the Font Style drop-down list box.
You have specified the font settings for P1.
Question
Suppose you want to create paragraph format PF with the "Right" alignment using Smart Styles. The Change Mode : Style ZSTYLE1 Language EN screen is opened for you.
What actions should you perform to do this?
Options:
1. Double-click Paragraph Formats, click Edit - Create Node, type PF in the Create Node dialog box, click Enter, and then on the Indents and Spacing tabbed page, select Right-aligned from the Alignment drop-down list box.
2. Select Paragraph Formats, click Edit - Create Node, type PF in the Paragraph Format dialog box, click Enter, and then on the Indents and Spacing tabbed page, select Right from the Alignment drop-down list box.
Answer
You double-click Paragraph Formats, you click Edit - Create Node, you type PF in the Create Node dialog box, you click Enter, and then on the Indents and Spacing tabbed page, you select Right-aligned from the Alignment drop-down list box.
In addition to paragraph formats, you can create character formats.
In character formats, you can specify two types of settings:
- Standards Settings
- Font
Standards Settings
In standard settings, you can specify settings for effects such as "superscript" and "subscript." In addition, you can specify settings for bar code to format selected text as bar codes.
Font
You use the font settings in character formats to specify settings such as font family, font size, font style, and font color for selected text in a paragraph.
Suppose you want to create a character format C1 in the ZStyle1 Smart Style. For this, you
- • add a node to the character format node • name the node C1
To do this, select the Superscript checkbox in the Effects section of the Standard Settings tabbed page, and then select BC_93 from the Name drop-down list box in the Bar Code section.
You have specified the desired standard settings for the character format C1.
You can also specify font settings for the character format C1 on the Font tabbed page. Suppose you want to set the font color to red.
For this, you click the Font tab, you select the Color checkbox, and then you select the red color from the drop-down list box associated with the Color checkbox.
Question
Suppose you want to create a character format CF with the font family "ANDALE_J" and font size "10" using Smart Styles. The Change Mode : Style ZSTYLE1 Language EN window is opened for you.
What actions should you perform to do this?
Options:
1. Double-click Character Formats, click Edit - Create Node, type CF in the Create Node dialog box, click Enter, click the Font tab, select ANDALE_J from the Font Family drop-down list box, and then type 10 in the Font Size text box.
2. Double-click Character Formats, click Smart Styles - Create Node, type CF in the Character Format dialog box, click Enter, and then on the Font tabbed page, select ANDALE_J from the Font Family drop-down list box and 10 from the Font Size drop-down list box.
Answer
You double-click Character Formats, you click Edit - Create Node, you type CF in the Create Node dialog box, you click Enter, you click the Font tab, you select ANDALE_J from the Font Family drop-down list box, and then you type 10 in the Font Size text box.
4. Formatting and printing Smart Forms
After you create a Smart Style, you can use the paragraph and character formats of the Smart Style in a Smart Form to format the text.
Suppose you created a Smart Form, ZFMM001_PURCHASE_ORDER, using a standard Smart Form – Purchase Order – provided by SAP. Now you want to apply the formats defined in the ZStyle1 Smart Style you created earlier.
For this, you first open the Smart Form from SAP Smart Forms: Initial Screen by typing the form name in the text box associated with the Form radio button and clicking Smart Forms - Change.
On the SAP Form Builder: Change Form ZFMM001_PURCHASE_ORDER screen, you can associate the ZStyle1 Smart Style with the Smart Form.
To do this, click Output Options on the Form Attributes page, select ZStyle1 from the Style combo box, and click Copy.
You have now associated the style ZStyle1 with the form ZFMM001_PURCHASE_ORDER. Now you can apply the paragraph format P1 and the character format C1 you created in ZStyle1 to the text in the form.
In the ZFMM001_PURCHASE_ORDER form, you want the Vendor Address text element to have the paragraph format P1. In addition, you want to apply the character format C1 to have the text in red.
To do this, double-click VENDOR Header in the form element hierarchy structure, select P1 from the Paragraph Formats list box on the General Attributes tabbed page, select Vendor Address in the text editor, and then select C1 from the Character Formats list box.
You applied the formats P1 and C1 to the Vendor Address text element of the "ZFMM001_PURCHASE_ORDER" Smart Form.
Now that you have created a Smart Form and applied the required formats to it, you can print the form by using its function module in a report program.
In a report program, you execute the function module associated with your Smart Form to print the form.
It is always preferred to dynamically retrieve the name of a function module using the SAP standard function module "SSF_FUNCTION_MODULE_NAME" because the name of a function module changes every time you activate the associated Smart Form.
This ensures that you always use the latest version of a function module.
report ZPurchase_Order .
parameters: PO_number(20) type n . " accept PO number from user
data : m_name type RS38L_FNAM . " variable to store the
" name of the function module of the Smart Form
" ZFMM001_PURCHASE_ORDER
" Now define an internal table to store PO information
" from the PO database table
data: begin of itab_PO occurs 0,
Number LIKE PO-Number,
Vendor_Code like PO-Vendor_Code,
Ven_Add LIKE PO-Ven_Add,
Date like PO-Date,
Amount like PO-Amount
end of itab_PO .
" fetch data of the PO number that the user specified
" from the PO table into the internal table
select Number Vendor_Code Ven_Add Date Amount
from PO into table itab_PO
where PO-Number = PO_Number .
" retrieve the name of the function module of the Smart Form
" ZFMM001_PURCHASE_ORDER
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZFMM001_PURCHASE_ORDER'
importing
m_name = fm_name .
You execute the standard function module by passing the Smart Form name to the formname variable of the standard function module and retrieve the name of the function module associated with the Smart Form from the fm_name variable of the standard function module.
After you retrieve the name of the function module associated with your Smart Form, you execute it by using the call function statement.
call function m_name
" pass data of the table itab_PO to the function module
" through its tables parameter
tables
itab_PO .
Supplement
Selecting the link title opens the resource in a new browser window.
Launch window
View the full content of the code to create the report program.
Question
Suppose you created a report program to display a sales order form. For this, you used the Smart Form "ZSales_Order."
What actions should you perform to do this?
Options:
1. Use the SAP standard function module SSF_FUNCTION_MODULE_NAME to retrieve the name of the Smart Form, and then use the variable sf_fm_name to call the function module associated with the Smart Form.
2. Use the SAP standard function module Create_Form to retrieve the name of the Smart Form, and then use the variable sf_fm_name to call the function module associated with the Smart Form.
Answer
You use the SAP standard function module SSF_FUNCTION_MODULE_NAME to retrieve the name of the Smart Form, and then you use the variable sf_fm_name to call the function module associated with the Smart Form.
Summary
The different features of Smart Forms – interactive Web Forms, routines, Smart Styles, tables, tools, and windows – provide benefits such as easier and lower turnaround time for form maintenance and Internet application support than in SAPscript.
During the processing of a Smart Form, a report program retrieves the name of the function module associated with the form, then the report program executes the function module, and finally, the function module prints the form.
To format text in Smart Forms you use Smart Styles. You can format texts at two levels – paragraph and character.
To print a Smart Form, you use a report program. In the report program, you execute the function module of the form and the function module prints the form.
No comments:
Post a Comment