Smartforms Tutorials
Smart Forms in SAP ABAP
SAP Smart Forms is 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).
SAP introduced SmartForms in 1998 to overcome the limitations in SAP Scripts. SmartForms are easier to develop, maintain and transport than SAP Script.
In this tutorial you will learn:
Smart Forms and SapScripts Comparison
Advanatges of Smart Forms
Architecture of SAP Smart Form
Smartforms Guide
Windows in Smart Forms
Smart Forms Programming Flow
Smart Forms and SapScripts Comparison
Multiple page formats are possible in SmartForms which is not the case in SAPScripts
It is possible to have a SmartForm without a main window.
Routines can be written in SmartForms tool.
SmartForms generates a function module when activated.
Labels cannot be created in SmartForms.
Advanatges of Smart Forms
They help adapting forms without any programming knowledge due to entirely graphical user interface
When activating the smart form the system automatically generates the function module and at the runtime .
To make any changes we have to use the Drag & Drop, Cut & Paste. These actions do not include writing of coding lines or using a script language.
We can insert static and dynamic tables. These include the line feeds in the individual table cells, triggering events for table headings and subtotals and sorting data before output.
The smart forms allow the user to include graphics, which can be displayed as a part of the form or as background graphics. During printout the user can suppress the background graphic as and when necessary.
Web Publishing is possible using the generated XML output
Architecture of SAP Smart Form
Smart Forms in SAP ABAP
Smartforms Guide
Lets go through it in SAP system-
Enter transaction SMARTFORMS in the transaction code box.
In the next screen , enter a from name and click create
Smart Forms in SAP ABAP
The next screen is divided into three sections-
Smart Forms in SAP ABAP
Navigation window consist of nodes and sub nodes. They contain all the elements (text, window etc) that belong to sap forms
Maintenance window shows attributes of the elements
Form printer window shows the layout of the page
Whenever we create smart forms, SAP creates/generates a function module.Unlike SAPscripts , SAP FORMS allow you to change language.
In the navigation window you will find
Global Data Declarations : The Data defined here can be used throughout the smartform for coding purposes.
Form Interface : Here all the data which will be passed to the smartform from the Print program is defined.
Smart Forms in SAP ABAP
Right-Clicking on the Pages will allow creation of New Page, Window, Graphic or Address.
Smart Forms in SAP ABAP
Printing will take place on the basis of 'next page' field.
But processing will happen as per the sequence in navigation window!
Smart Forms in SAP ABAP
For background picture and graphics you can pick up either black and white or color bitmap images and are stored in the form of standard texts. You may take a detour from the smartform screen and open Form Graphics screen. Transaction code: Se78
Smart Forms in SAP ABAP
Setting in the Graphics in Smart Form Window-
Smart Forms in SAP ABAP
Windows in Smart Forms
Smart Forms in SAP ABAP
There are two types of Windows
Main
Secondary
Important Points to Note
You cannot have more than 1 main window in a page. You can have multiple secondary windows
Whatever you print in secondary window...it has to be static. (If u have 20 lines in a PO and there is page constraint the lines get carried forward to next page in the main window. i.e. In a predecessor and successor type of content, they will be printed in sequence in main window. This is not allowed in Secondary windows.
Smart Forms in SAP ABAP
Inside the main window we can add text as introduction to customize the form output.
Smart Forms in SAP ABAP
The Output options on each window determine the Line size, Width, Colors and background to be put.
Smart Forms in SAP ABAP
Smartforms gives the option of giving the address number which is maintained in the central address management. The address will be directly taken from ADRC table and will be populated in the form.
Smart Forms in SAP ABAP
The two different editors are available in Smartforms viz. Normal Editor
Smart Forms in SAP ABAP
and the Graphics Editor.
Smart Forms in SAP ABAP
This setting can be changed using the Configure editor in Utilities.
In Table painter, you can draw the format as per client requirement (e.g. Heading, Sub Heading, Item, Sub Total, Grand Total etc.)
You can use the table layout to determine:
The number of lines and cells
The height of each line
The width of each cell
The alignment of the table in the window
Smart Forms in SAP ABAP
The Table shows the different line types which will be used in the table. The Line types define the size of each cell and the number of cells in each line.
Smart Forms in SAP ABAP
Smart Forms Programming Flow
When an SAP Smart Form template is created, a user creates the form layout, defines the required fields, conditions, and special programming instructions in the Smart Form template using the Smart Form Builder.
After the form design is complete, the form needs to be activated before it can be tested or accessed by the print programs.Activating the form initiates the generation of a function module that handles all of the form's processing.
This function module interacts with the application program/print program to create the output in the user-defined output media for the specified device.
In case of smart forms, we use 2 function modules for the processing of the smart form. To the first function module , we pass the name of the smart form as the import parameter. This then returns the name of the dynamically generated function module which will actually call the smartform.
The smartform name can be passed on to the function Module - 'SSF_FUNCTION_MODULE_NAME'
Smart Forms in SAP ABAP
This will return the Function module name of the smartform which is referenced.
Smart Forms in SAP ABAP
The Print program will be calling the FM 'SSF_FUNCTION_MODULE_NAME' to get the Function module name at Runtime. Therafter it will call the Function module thus obtained to execute the smartform.
Smart Forms in SAP ABAP
Templates
Template can be used when you know the exact size of the output or the output is in a fixed format.
E.g. Tax form/ cheques /airline form/railway ticket: all these use templates.
The big between table and template is that in a Table the height changes dynamically.We call a row a 'line' in template.
Smart Forms in SAP ABAP
SMART Styles
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 use the transaction 'smartforms' / 'smartstyles' to create a smart style.
SAP Smart Forms tool can be used to print and send documents. This tool is useful in developing forms, PDF files, e-mails and documents for the Internet. The tool provides an interface to build and maintain the layout and logic of a form. SAP also delivers a selection of forms for business processes such as those used in Customer Relationship Management (CRM), Sales and Distribution (SD), Financial Accounting (FI) and Human Resources (HR).
The tool allows you to modify forms by using simple graphical tools instead of using any programming tool. It means that a user with no programming knowledge can configure these forms with data for a business process effortlessly.
In a Smart Form, data is retrieved from static and dynamic tables. The table heading and subtotal are specified by the triggered events and the data is then sorted before the final output. A Smart Form allows you to incorporate graphics that can be displayed either as part of the form or as the background. You can also suppress a background graphic if required while taking a printout of a form.
Some examples of standard Smart Forms available in SAP system are as follows −
SF_EXAMPLE_01 represents an invoice with a table output for flight booking for a customer.
SF_EXAMPLE_02 represents an invoice similar to SF_EXAMPLE_01, but with subtotals.
SF_EXAMPLE_03 specifies an invoice similar to SF_EXAMPLE_02, but one in which several customers can be selected in an application program.
Creating a Form
Let’s create a form by using the SAP Smart Forms tool. You will also learn how to add a node in the Smart Form and test the form in this tutorial. Here we begin with creating a copy of the SF_EXAMPLE_01 form. The SF_EXAMPLE_01 form is a standard Smart Form available in the SAP system.
Step 1 − Smart Form Builder is the main interface used to build a Smart Form. It is available on the initial screen of SAP Smart Forms. We need to type the 'SMARTFORMS' transaction code in the Command field to open the initial screen of SAP Smart Forms. In this screen, enter the form name, SF_EXAMPLE_01, in the Form field.
Step 2 − Select Smart Forms → Copy or click the Copy icon to open the Copy Form or Text dialog box.
Step 3 − In the Target Object field, enter a name for the new form. The name must begin with the Y or Z letter. In this case, the name of the form is 'ZSMM1'.
SAP Smart Form
Step 4 − Click the Continue icon or press the ENTER key in the Copy Form or Text dialog box so that the ZSMM1 form is created as a copy of the predefined form SF_EXAMPLE_01.
Step 5 − Click the Save icon. The name of the form is displayed in the Form field on the initial screen of SAP Smart Forms.
Step 6 − Click the Create button on the initial screen of SAP Smart Forms. The ZSMM1 form appears in Form Builder.
Step 7 − The first draft page is created with a MAIN window. All the components of the new form are based on the SF_EXAMPLE_01 predefined form. You can just click a node in the Navigation menu to view its content.
SAP Form Builder
Creating a Text Node in the Form
Step 1 − Open a form in the change mode of the SAP Form Builder screen and right-click the Main Window option in the First Page node and select Create → Text from the context menu.
Step 2 − Modify the text in the Text field to 'My_Text' and the text in the Meaning field to 'Text_Demo'. Enter the text 'Hello TutorialsPoint.....' in the text-editing box in the center frame of Form Builder as shown in the following snapshot −
Create Text Node
Step 3 − Click the Save button to save the node.
Step 4 − Activate and test the node by clicking the Activate and Test icons, respectively. The initial screen of Function Builder appears.
Step 5 − Activate and test the function module by clicking the Activate and Execute icons. The parameters of the function module are displayed in the initial screen of Function Builder.
Step 6 − Execute the function module by clicking the Execute icon. The Print dialog box appears.
Step 7 − Specify the output device as 'LP01' and click the Print preview button.
The above steps will produce the following output −
Print Preview
SAP Smart Forms is 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).
SAP introduced SmartForms in 1998 to overcome the limitations in SAP Scripts. SmartForms are easier to develop, maintain and transport than SAP Script.
In this tutorial you will learn:
Smart Forms and SapScripts Comparison
Advanatges of Smart Forms
Architecture of SAP Smart Form
Smartforms Guide
Windows in Smart Forms
Smart Forms Programming Flow
Smart Forms and SapScripts Comparison
Multiple page formats are possible in SmartForms which is not the case in SAPScripts
It is possible to have a SmartForm without a main window.
Routines can be written in SmartForms tool.
SmartForms generates a function module when activated.
Labels cannot be created in SmartForms.
Advanatges of Smart Forms
They help adapting forms without any programming knowledge due to entirely graphical user interface
When activating the smart form the system automatically generates the function module and at the runtime .
To make any changes we have to use the Drag & Drop, Cut & Paste. These actions do not include writing of coding lines or using a script language.
We can insert static and dynamic tables. These include the line feeds in the individual table cells, triggering events for table headings and subtotals and sorting data before output.
The smart forms allow the user to include graphics, which can be displayed as a part of the form or as background graphics. During printout the user can suppress the background graphic as and when necessary.
Web Publishing is possible using the generated XML output
Architecture of SAP Smart Form
Smart Forms in SAP ABAP
Smartforms Guide
Lets go through it in SAP system-
Enter transaction SMARTFORMS in the transaction code box.
In the next screen , enter a from name and click create
Smart Forms in SAP ABAP
The next screen is divided into three sections-
Smart Forms in SAP ABAP
Navigation window consist of nodes and sub nodes. They contain all the elements (text, window etc) that belong to sap forms
Maintenance window shows attributes of the elements
Form printer window shows the layout of the page
Whenever we create smart forms, SAP creates/generates a function module.Unlike SAPscripts , SAP FORMS allow you to change language.
In the navigation window you will find
Global Data Declarations : The Data defined here can be used throughout the smartform for coding purposes.
Form Interface : Here all the data which will be passed to the smartform from the Print program is defined.
Smart Forms in SAP ABAP
Right-Clicking on the Pages will allow creation of New Page, Window, Graphic or Address.
Smart Forms in SAP ABAP
Printing will take place on the basis of 'next page' field.
But processing will happen as per the sequence in navigation window!
Smart Forms in SAP ABAP
For background picture and graphics you can pick up either black and white or color bitmap images and are stored in the form of standard texts. You may take a detour from the smartform screen and open Form Graphics screen. Transaction code: Se78
Smart Forms in SAP ABAP
Setting in the Graphics in Smart Form Window-
Smart Forms in SAP ABAP
Windows in Smart Forms
Smart Forms in SAP ABAP
There are two types of Windows
Main
Secondary
Important Points to Note
You cannot have more than 1 main window in a page. You can have multiple secondary windows
Whatever you print in secondary window...it has to be static. (If u have 20 lines in a PO and there is page constraint the lines get carried forward to next page in the main window. i.e. In a predecessor and successor type of content, they will be printed in sequence in main window. This is not allowed in Secondary windows.
Smart Forms in SAP ABAP
Inside the main window we can add text as introduction to customize the form output.
Smart Forms in SAP ABAP
The Output options on each window determine the Line size, Width, Colors and background to be put.
Smart Forms in SAP ABAP
Smartforms gives the option of giving the address number which is maintained in the central address management. The address will be directly taken from ADRC table and will be populated in the form.
Smart Forms in SAP ABAP
The two different editors are available in Smartforms viz. Normal Editor
Smart Forms in SAP ABAP
and the Graphics Editor.
Smart Forms in SAP ABAP
This setting can be changed using the Configure editor in Utilities.
In Table painter, you can draw the format as per client requirement (e.g. Heading, Sub Heading, Item, Sub Total, Grand Total etc.)
You can use the table layout to determine:
The number of lines and cells
The height of each line
The width of each cell
The alignment of the table in the window
Smart Forms in SAP ABAP
The Table shows the different line types which will be used in the table. The Line types define the size of each cell and the number of cells in each line.
Smart Forms in SAP ABAP
Smart Forms Programming Flow
When an SAP Smart Form template is created, a user creates the form layout, defines the required fields, conditions, and special programming instructions in the Smart Form template using the Smart Form Builder.
After the form design is complete, the form needs to be activated before it can be tested or accessed by the print programs.Activating the form initiates the generation of a function module that handles all of the form's processing.
This function module interacts with the application program/print program to create the output in the user-defined output media for the specified device.
In case of smart forms, we use 2 function modules for the processing of the smart form. To the first function module , we pass the name of the smart form as the import parameter. This then returns the name of the dynamically generated function module which will actually call the smartform.
The smartform name can be passed on to the function Module - 'SSF_FUNCTION_MODULE_NAME'
Smart Forms in SAP ABAP
This will return the Function module name of the smartform which is referenced.
Smart Forms in SAP ABAP
The Print program will be calling the FM 'SSF_FUNCTION_MODULE_NAME' to get the Function module name at Runtime. Therafter it will call the Function module thus obtained to execute the smartform.
Smart Forms in SAP ABAP
Templates
Template can be used when you know the exact size of the output or the output is in a fixed format.
E.g. Tax form/ cheques /airline form/railway ticket: all these use templates.
The big between table and template is that in a Table the height changes dynamically.We call a row a 'line' in template.
Smart Forms in SAP ABAP
SMART Styles
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 use the transaction 'smartforms' / 'smartstyles' to create a smart style.
SAP Smart Forms tool can be used to print and send documents. This tool is useful in developing forms, PDF files, e-mails and documents for the Internet. The tool provides an interface to build and maintain the layout and logic of a form. SAP also delivers a selection of forms for business processes such as those used in Customer Relationship Management (CRM), Sales and Distribution (SD), Financial Accounting (FI) and Human Resources (HR).
The tool allows you to modify forms by using simple graphical tools instead of using any programming tool. It means that a user with no programming knowledge can configure these forms with data for a business process effortlessly.
In a Smart Form, data is retrieved from static and dynamic tables. The table heading and subtotal are specified by the triggered events and the data is then sorted before the final output. A Smart Form allows you to incorporate graphics that can be displayed either as part of the form or as the background. You can also suppress a background graphic if required while taking a printout of a form.
Some examples of standard Smart Forms available in SAP system are as follows −
SF_EXAMPLE_01 represents an invoice with a table output for flight booking for a customer.
SF_EXAMPLE_02 represents an invoice similar to SF_EXAMPLE_01, but with subtotals.
SF_EXAMPLE_03 specifies an invoice similar to SF_EXAMPLE_02, but one in which several customers can be selected in an application program.
Creating a Form
Let’s create a form by using the SAP Smart Forms tool. You will also learn how to add a node in the Smart Form and test the form in this tutorial. Here we begin with creating a copy of the SF_EXAMPLE_01 form. The SF_EXAMPLE_01 form is a standard Smart Form available in the SAP system.
Step 1 − Smart Form Builder is the main interface used to build a Smart Form. It is available on the initial screen of SAP Smart Forms. We need to type the 'SMARTFORMS' transaction code in the Command field to open the initial screen of SAP Smart Forms. In this screen, enter the form name, SF_EXAMPLE_01, in the Form field.
Step 2 − Select Smart Forms → Copy or click the Copy icon to open the Copy Form or Text dialog box.
Step 3 − In the Target Object field, enter a name for the new form. The name must begin with the Y or Z letter. In this case, the name of the form is 'ZSMM1'.
SAP Smart Form
Step 4 − Click the Continue icon or press the ENTER key in the Copy Form or Text dialog box so that the ZSMM1 form is created as a copy of the predefined form SF_EXAMPLE_01.
Step 5 − Click the Save icon. The name of the form is displayed in the Form field on the initial screen of SAP Smart Forms.
Step 6 − Click the Create button on the initial screen of SAP Smart Forms. The ZSMM1 form appears in Form Builder.
Step 7 − The first draft page is created with a MAIN window. All the components of the new form are based on the SF_EXAMPLE_01 predefined form. You can just click a node in the Navigation menu to view its content.
SAP Form Builder
Creating a Text Node in the Form
Step 1 − Open a form in the change mode of the SAP Form Builder screen and right-click the Main Window option in the First Page node and select Create → Text from the context menu.
Step 2 − Modify the text in the Text field to 'My_Text' and the text in the Meaning field to 'Text_Demo'. Enter the text 'Hello TutorialsPoint.....' in the text-editing box in the center frame of Form Builder as shown in the following snapshot −
Create Text Node
Step 3 − Click the Save button to save the node.
Step 4 − Activate and test the node by clicking the Activate and Test icons, respectively. The initial screen of Function Builder appears.
Step 5 − Activate and test the function module by clicking the Activate and Execute icons. The parameters of the function module are displayed in the initial screen of Function Builder.
Step 6 − Execute the function module by clicking the Execute icon. The Print dialog box appears.
Step 7 − Specify the output device as 'LP01' and click the Print preview button.
The above steps will produce the following output −
Print Preview