Vous êtes sur la page 1sur 80

Smart Forms

 SAP uses Smart Forms 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 Script Vs Smartforms

6 Multiple page formats possible in smartform


6 Main window may not be there in smartform
6 Routines can be written in smartforms
6 Smartform creates a function module when activated
Advantages

6 =reating and maintaining forms requiring half the time

6 Adapting forms without any programming knowledge


6 due to entirely graphical user interface

6 Web Publishing using the generated XML output


6 Smart forms execute faster than Sap Script
Features

6 SAP Smart Forms allow you to execute simple modifications to the


form and in the form logic by using simple graphical tools.

6 To print a form, you need a program for data retrieval and a Smart
Form that contains the entire form logic. When activating the Smart
Form, the system automatically generates a function module.

6 You design a form using the graphical Form Painter and the
graphical Table Painter. The form logic is represented by a hierarchy
structure (tree structure) that consists of individual nodes, such as
nodes for global settings, nodes for texts, nodes for output tables, or
nodes for graphics.

6 For Web publishing, the system provides a generated XML output of


the processed form.
Features

6 You can insert static and dynamic tables. This includes line feeds
in individual table cells, triggering events for table headings and
subtotals, and sorting data before output.
6 SAP Smart Forms allow you to include graphics, which you can
display either as part of the form or as background graphics.
General =oncepts on Form Printing

6 Form printing covers creating and maintaining a form for mass


printing in SAP Systems.
6 The layout determines the page structure, that is the number of
differently structured pages and the positions of the output areas on
these pages.
6 The form logic controls the dynamic formatting of the form.
They find use in :
Order confirmations Invoices
Account statements =hecks
Salary statements Delivery notes
=ustoms forms Industry-specific forms
Architecture
For printing a form we need two components :
1. Smartform : Definition of form layout and form logic
2. Application Program: ABAP Program for data retrieval
How does the Smartform work

When we 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 modules interface (which corresponds
to the form interface) to transfer any table data previously
selected and to print the form according to the form
description.
=reation of Smartform

When creating a form we have to:


1. Retrieve application data
2. Describe the form
3. Pass the application data to the form
Retrieving Application Data

For fetching the application data, 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 we initialize the form, we can format the data, which we


passed to the form, for output in the form. Formatting data in the
form and not in the data retrieval program allows us to use one
data retrieval program for several forms with different formatting
routines.
Describing the form

Global settings

Global settings in a smart form consist of :


6 Form Attributes
6 Form Interfaces
6 Global definition
Form Attributes

In the form attributes we define the print settings like :


 The page format (eg: DINA4, DINA3 etc.)
 =haracters per inch
 Lines per inch
 Style (Smart Style / System style)
 Flag for XSF output
Form Attributes
Form Interfaces

Form interface is like the import / export parameters of any


function module. Activation of Smartform will create a new
function module. This form interface will have the import /
export parameters.

Form interface contains:


6 Import tab
6 Export tab
6 Tables tab
6 Exceptions tab
Form Interfaces
We define the form interface to pass the data to the form. In the form
interface we can define import and export parameters, tables and
exceptions.
Global Definition

Global definition apply for the entire form. We can use any
object defined there in all nodes of the tree.
We can initialize the global data before we start processing
the start page. Within the form routines we cannot access any
global data unless we explicitly pass them to the form routine
interface.
Global Definition
Structure of Form

A form is similar to a layout and contains the following :


1. Pages
2. Windows
3. Addresses
4. Graphics
5. Tables or templates
6. Data and text contents
Pages of a form

6 On the pages of a form you determine the page layout and


the sequence of pages with different structures.

6 The individual pages in the form may differ in their structure.

6 We specify the next page to make the page sequence clear.


For recursive output call the same page repeatedly
Types of Windows

On a page there are two different types of output areas for text
and data:- the Main window and the Sub window.

Main Window : In a main window you display text and data,


which can cover several pages .We can define only one window
in a page as a main window.

Sub Window : In a sub window you display text and data in a


predetermined output area (i.e. Header, Footer etc).
Describing the Form

Describe the interface of the form. It results from the


application data previously selected.
=reate one or more pages. On a page, you can position
windows, addresses, and graphics. Within a window, you can
create additional elements.
=reate elements (text, graphics, tables, and so on) for each
page, using other tools of the Form Builder:
y Use the Form Painter to position windows, graphics, and
addresses on a page (the other elements are displayed
in an assigned window).
y Use the P= Editor to write your texts.
y Use the Table Painter to format your tables.
Form Logic
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:

Nodes
Nodes in Smartforms

    

6 w 
6 
6 

6 
6  
6 
6  
6 
6    
6 
6 
 
6 w  
Nodal Flow
The numbering of the nodes also shows the sequence in which they are
processed (from top to bottom). The first node is the p   . The  p of
a node are all nodes included directly under this node in the hierarchy. For node 5
these are the nodes 6 to 9 (direct successors are only the nodes of the next
hierarchy level, that is 6, 7, and 9).
 

- v v 

 
 

      
 

  
  



 
 
  

 

 
 
  


  
 


   
   



 


 
 


 
 


  
 

E   
 
 
  !

    
  

 




 

 
 !
 
  

"   

 


  
  


 


 # 
  




w  
  

 




 

 


 
 
 
 


   
  

  
 


 

- vv

ð t t
t  
 t 

t




ð  t t tf t t   t   t 



t t t t  t

ð  t t f t t 


 t t  t
 t t

F =t
t  
 t 

t




=  $t

  
t  



    tt

 





  t  t    

t tv  


 t t



  t t t
ð$ 
F $ðt



ft
  
 t
   

Nodes - Overv e

Other Nodes
Node t e es r t o oss e d re t s essors

o der Co es s essor odes to e e t do d e odes


o ro s
Co  e se t o Co es ttr tes o the ode e et do d  e odes
tes te  te t e oo o der

ro r es e tes ro r ode or o s essors


e  e overs o ro t es
Tools in Smartforms

ð  
   



 

6 Form Painter
6 Table Painter
6 P= Editor
6 Navigation Tree
Form Painter

h 
  
 

6 Used to design the layout of the smartform


6 Similar to graphical painter in Sap Scripts
6 We can create and change the size of the windows
6 We can graphical images also
Form Painter

ð  
       

6 Design area with ruler, cursor with help lines, and he grid
and main grid.
6 Display of the cursor position in the ruler, which can be
suppressed and set.
6 Two level grid with engage function which can be
customized.
6 When creating, changing and moving a window, the
window size appears in the ruler.
6 Detachable toolbar containing the most important
functions.
Form Painter

ð  
        

6 Autoscrolling when moving windows, placing windows in


the background.
6 Zoom factors that can be set to any value and autozooming
of the design area to the window size.
6 Sensitive context menu.
6 Placing a scanned graphic into the background of the
design area.
Form Painter
Table Painter

6 Ä   


6      
6 Ä 
6  
6     
6  !   
Table Painter
P= Editor

6 È        



6         
6    
Text and Data in Form (P= - Editor)

We can enter text in an editor. Data can be characters,strings or


numbers.
Style Builder

ë  

 Header data containing the default values of a Smart Style
 Paragraph formats including indents and spacing, font
attributes, tabs, and outline and numbering
 =haracter formats including effects (superscript,
subscript), bar-code and font attributes
 =olors and underlines for a paragraph or character format
 Preview

Transaction code - SMARTSTYLES or SMARTFORMS by


selecting smart style option
Style Builder
Field List & Error List

FIELD LIST :
The field list displays the following data in the form a tree structure:
6 All tables, fields and structures passed via the form interface.
6 System fields and the fields that are defined in the global
definitions.

This allows one to check whether a correct field name has been
entered or not and that the form knows the field or not. To display the
field list, in the form builder choose field list On/Off.

ERROR LIST:
The error list contains the list of errors and warnings displayed at the
bottom of the maintenance screen. That is when we check the smart
forms and if any error occurs, it will be displayed at the bottom of the
maintenance screen.
Field List & Error List
!
   
 

There are two tools to migrate the SAP scripts to Smart forms

Individual Migration.
Mass Migration
R
!


Form Migration

Go to SAP Smartforms initial screen and enter the smart form name you want to create
in the Form field.

=hoose Utilities 6 Migrate SAP script form and

Enter the name and the language of the Source form (SAP script).

=hoose Enter.

Now change the design of the form and of the form logic. To activate the Smart form choose
Activate
 !


Style Migration

Go to initial screen of Smart styles


In the Style name field enter the name of the style you want to create.

=hoose Smart styles 6 =onvert SAP Script style.

Enter the name of the name of the SAP script style you want to convert.
=hoose Enter.

=hoose Back . Now change the style as you wanted and activate the style you have created
!
!


Execute the Report M p.

Select the names and the language of the SAP script forms and choose


The system creates the Smart forms under the names of the SAP script forms plus the
extension _SF.

To change and adapt the form , go to transaction SMARTFORMS. Then activate the
changed smart form.
È È
Test Scenario

Need to print the invoice details. The expected format is like:


Test Scenario

Develop a small program for data selection and to call the


Smart form

Report YINVOI=E is
developed for this.
Based on the
selection screen
invoice number, this
program will select
invoice / Partner /
Material details from
VBRK / VBRP / VBPA /
MAKT and pass the
details in the form of
variables / internal
table to the Smart
form
Test Scenario
Program« =ontinued
Test Scenario

SMARTFORM - YINVOI=E is created


Form Interface - IMPORT tab & TABLES tab
Test Scenario

SMARTFORM - YINVOI=E

Global Definitions

PASTE THE S=REEN SHOT AT THE END


Test Scenario

New ³Window´ can be created by right clicking on the ³Page´

All ³=reate/insert´ options are available on right click. For example if we need to insert
Graphic in a window, mouse right click by keeping the cursor position on the window!!
Test Scenario

Window name / description can be changed after creating it

Inserting the ³Graphic´ in the created ³LOGO´ window


Test Scenario

In the Graphic node, the name and description are changed + a


new image is selected by pressing F4 (Value request)
Test Scenario

Aligning the Graphic (LOGO) window using ³Form Painter´


Test Scenario

Window for displaying the header ³Invoice Details´:

Window created with name HEADING:

Text node is inserted (by right click option) and the text ³INVOI=E DETAILS´ is entered
Test Scenario

Window for displaying the header ³Invoice Details´:

As per our required format, the text should get displayed with under line. For that purpose a
smartstyle YINVOI=E is created. Different paragraphs are created in that (for plain text, bold
text, bold and under line, small letters, etc)

For displaying Invoice Details with under line, the paragraph format P3 can be used.
Test Scenario

Window for displaying the header ³Invoice Details´:

In the output options tab of text node, the smartstyle is entered:

Once the style is mentioned, the ³General attributes´ tab will get the styles described in
YINVOI=E smartstyle. Selecting the P3 format for displaying this text

After this, the HEADING window is aligned using ³Form Painter´:


Test Scenario

Window for displaying the Bill to Address


An Alternate has been created to fetch the Bill to Address
Test Scenario

An Alternate to fetch the Bill to Address

The alternate evaluates the condition whether the variable v_adrnr_bp is not equal to
space and if true, the code logic under the true node will be executed, otherwise the code
logic under the false node will be executed
 
 
   
Test Scenario

=ode Logic for getting Bill To Address

The variables needed for getting the information to be declared in Global Definitions and
also to be passed as Input Parameters and Output Parameters in the code logic as
marked above
The select statement fetches the address details from ADR= using the variable
v_adrnr_bp. The text elements Name, Street and =ity are created to print the Bill to
address
Test Scenario

Window for displaying the Ship to Address

Similarly for Ship to Address also, a window is created. An alternate like bill to address is
created which evaluates the variable v_adrnr_sh and if true the code logic under true node
is executed, otherwise false node is executed. The text elements Name1, Street1 and =ity1
are used to display the Ship to address
Test Scenario

=reating a table for printing Line Items


Test Scenario

A Table for printing the Line Items in the Invoice

A table has been created with columns for and the line type is %LTYPE1.Table consists of a header,
Main area and footer portion
Test Scenario

A Table for printing the Line Items in the Invoice

In the Data tab, in the loop section, the internal table to be specified. The looping action takes
place in the internal table and the line items are printed in the main area.
Test Scenario

Table for Printing Line Items

A row has to be created in the header portion of the table so as to print the headings of the
columns in the table. The line type to be specified when creating a row

The Line type we have created for this table


is %LTYPE1
Test Scenario

Table for Printing Line Items - Header

When a row is created with the line type %LTYPE1 then four cells or columns are
automatically created in the row. Under the =ell1 the Material text element is created
for printing the heading Material. Similarly for Description, Quantity and Price text
elements are created under the =ell2, =ell3 and =ell4 for printing those headings.
Test Scenario

Table for Printing Line Items ± Main Area

A row has been created in the main area with line type %LTYPE1. Under the =ell1 the text
element for printing material number is created. Similarly for Description, Quantity and
Price text elements are also created for printing those data under =ell2, =ell3 and =ell4.
The looping action takes place in the main area. All line items in the internal table is
printed. The field name specified in the text element as &i_inv-matnr& which is the field
name in the internal table
Test Scenario

Table for Printing Line Items ± Footer

In the footer portion of the table any texts or any footer data can be printed. A row can be
created with the line type %LTYPE1 and text elements can be created in each cell.
Test Scenario

Template for printing Footer Details

A window is created with the name reference and a template is created under the window
Test Scenario

Template for printing Footer Details

Rows and columns are created in the template using the pencil pointer of the template.
The template has 2 lines and 2 columns
Test Scenario

Template for printing Footer Details

A text element named


ReferenceDoc is
created under the
template node

In the output options


tab, in output structure
section, the line and
column of template is
specified. This reference
doc # output appears in
the line 1and column 1
of the template.
Test Scenario

Template for printing Footer Details

The text element Dated is printed in Line 1 and column 2 of the template. Similarly the
corresponding data of the reference and date is configured to print in line 2, column 1
and column 2 of the template.
Test Scenario

Address for printing Footer Address

A window named Footeraddress is created and under the window an address node is
created.
Test Scenario

Address for printing Footer Address


Test Scenario

Address for printing Footer Address

In the General Attributes tab, the


type is chosen as organization
address and the address number is
given as 12879.

The default paragraph for the


output is given as P1. The number
of lines to be printed is given as 5

By default, the address of the


specified address number is picked
and printed in the output.
Test Scenario

=ommand for branching to a New Page

The command node is


used to branch to a new
page provided the page
we wish to branch exists.
You can branch to a new
page as long as you are
still displaying the contents
of the main window.
Test Scenario

=ommand for branching to a New Page

In the General Attributes tab, tick Go to New Page and determine the new page using the
list box next to the check box. The output of main window will continue in new page

Vous aimerez peut-être aussi