ABAP Training-SAP-SmartForms

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 32

SAP SmartForms

Use of Smartform

Smartforms are used for designing and printing various types of
application documents across the various SAP modules like SD, FI, PU, IM,
WM etc. Smartforms are used for mass printing like monthly invoices sent by
telecom companies or salary statements.

 SAP AG 2005, 2
Smartform has 3 driving components : Print Program, Layout Set and
Function module.

1. Application Data is
fetched by the Print
Program from the
database depending
upon the selection
screen parameter.
2. Function module of a
Layout Set is
generated when the
smartform is activated.
3. The output of
application document is
sent to printer or mail or
fax.

 SAP AG 2005, 3
To develop a smartform object one needs to develop following objects :
1. Smartform Layout :

Can be developed in the Form Painter

Decides the data format
Transactions to use : Smartforms
Smartstyles - To design our own style.
2. Print Program :

Performs data selection based on selection criteria

Passes data to the smartform function module
Transaction to use : SE38 to develop a print program.

 SAP AG 2005, 4
 SAP AG 2005, 5
Smartform screen is divided in following 3 components.

Navigation Menu Maintenance Frame Form Painter

 SAP AG 2005, 6

Navigation Menu – This screen appears on the left of the screen.

Maintenance frame – This frame appears in the middle of the screen.

Form painter frame – This frame appears on the right of the screen. If form
painter is not visible on the screen , then choose option Form Painter.
You can control whether form painter is hidden or visible.

A form consists of following components :


-Pages -Table
-Windows -Template
-Graphics -Flow Logic
- Data or text contents -Folder
- Address

 SAP AG 2005, 7
Root Nodes

Global Settings

Pages and Windows.

Attributes

General Attributes

Output Options

Conditions

 SAP AG 2005, 8
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:

Successors of Node Pages and Windows

 SAP AG 2005, 9
 SAP AG 2005, 10

On the pages of a form you determine the page layout and the
sequence of pages with different structures.The page layout
includes the page format (for example, DIN A4, Letter, DIN A5
landscape) and the position of the windows on a page.


The individual pages of a form may differ in their structure. For
each page, you must specify a next page to make the page
sequence clear.


Many forms contain only two pages of different structure: the first
page, which calls the next page, and the next page, which calls
itself. If the text does not entirely fit onto the second page, another
document page is automatically displayed.

 SAP AG 2005, 11

You can position windows anywhere on a page, even overlapping.
You can position the same window (determined by the technical
name) on several pages of a form, so that the same contents are
displayed on all these pages. You can On a page, there are two
different types of output areas for texts and data: the main
window and the subwindow.

choose a different size for the window on each page, except for
the main window.

Main Window : In a main window you display text and data,
which can cover several pages (flow text). As soon as a main
window is completely filled with text and data, the system
continues displaying the text in the main window of the next page.
It automatically triggers the page break.

 SAP AG 2005, 12

In a subwindow you display text and data in a
predetermined output area. There is no flow text
display with page break. If you position a subwindow
with the same name on several pages, the system
displays the contents of this subwindow on each page.

Text and data that do not fit into the subwindow are
truncated and not displayed.

 SAP AG 2005, 13

Table size is decided at runtime depending upon the type and number
of records.

Line Types : Table width is determined from line types. Line type
specifies how many lines a table line should hold and what width
these cells should have.

 SAP AG 2005, 14
Template size is determined at design time in the Form Painter.

 SAP AG 2005, 15
Form Text types

Text elements

Text modules

Include texts

Dynamic texts

 SAP AG 2005, 16
In order to avoid hardcoding we can use the concept of
parameterized text. Here you can assign a text or value to a
variable or pass in a ztable and then use this variable (or table
field) directly instead of hardcoding the text or value.

e.g.

In the above example we can also pass &nast-spras& or &sy-


langu& instead of hardcoding the language as ‘EN’
 SAP AG 2005, 17
Events: Conditions:
With this option you can decide where you want to
display the text or data of that particular node. You can define
conditions for individual
nodes, or for whole sub
hierarchies of the
context.

 SAP AG 2005, 18
Form attributes – Contains administrative info of the form.
1)General attributes like created by, creation date, creation time.
2)Output options a) Style
b)Page format
c)Output formats(Standard/XSF/XSF+HTML).

Form interface – Through Form Interface application (print) program can


interact with smartform and vice a versa. It has four tabs

Import

Export

Tables

Exceptions

 SAP AG 2005, 19
Global Definitions – All the variables that are global across the
smartform are declared here. Here we have five tabs
 Global
 Data Types
 Initialization Field
 Symbols
 Form Routines.

 SAP AG 2005, 20
Application program consists of 3 parts :
a. Data selection from the database.

b. Determining the name of generated function module using


‘SSF_FUNCTION_MODULE_NAME’.

c. Actual form processing: The generated function module is called for


each document to be created.

The form is triggered by calling 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.

 SAP AG 2005, 21
The name of the generated function module is unique only within one system. Therefore, always call the
function module first that uses the form name to determine the current name of the generated function
module.
Procedure to carry out in Print Program:

First define the form interface in your form and activate the form.

In the form builder call the function Environment  Function Module
Name and copy its name.

In the application program define a variable of type RS38L_FNAM for the name of the generated function
module:
data fm_name type RS38L_FNAM

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 = fm_name
EXCEPTIONS
NO_FORM =1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
<error handling>
ENDIF.

 SAP AG 2005, 22

Call the generated function module .

CALL FUNCTION fm_name


EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
G_CARRID = <variable>
G_CONNID = <variable>
* IMPORTING
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
GT_SBOOK = <internal table>
EXCEPTIONS
FORMATTING_ERROR =1
INTERNAL_ERROR =2
SEND_ERROR =3
OTHERS = 5.

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

 SAP AG 2005, 23
- The basic configuration required to do for smartform is creating output type
and attaching the smartform to the output type.
- NACE is the transaction to set the output type.
- In this transaction first the application is selected ( e.g.V1 Sales, V2 Shipping
etc)
- Then output type is selected. Sometimes output type is created newly if driver
program and smartform are custom program and not SAP standard ones.
- Whenever new output type is created , 3 parameters are required. They are :
- Smartform Name
- Driver Program Name
- ENTRY routine name.
- Incase of FI forms, configuration is done using BTEs (Business Transaction
Events) since NACE cannot be used to configure FI forms.

 SAP AG 2005, 24
Quick Overview of Node Usage
before starting with exercise

 SAP AG 2005, 25
Transactions
SMARTFORMS Create Smartform

SMARTSTYLES Create style

SO10 Create standard Text

SE38 Create print program

SE78 Upload Logo

 SAP AG 2005, 26
Field List on / off

1. Debugging smartform

2. Adding variables in text


node

Field List
 SAP AG 2005, 27
 SAP AG 2005, 28

Required parameters

Optional parameters
control_parameters
output_options
user_settings
job_output_info, job_output_options

 SAP AG 2005, 29
Configuration required for
Smartform

Output Type : Output type connects the application
program and the layout. The application program
actually retrieves the data and layout defines the
placement of this data. To attach the layout to an
application program output type should be defined.

How to define Output type : For SD module
SPRO  Sales and Distribution  Basic Functions 
Output Control  Output Determination  Maintain
output types.

 SAP AG 2005, 30
Downloading of Smartform
1. Go to Smartforms transaction. Specify a form name that you want to
download.
2. Select to Utilities->Download Form at menu bar. You will get a popup to
specify the location where you want to download.
3. On click on Save , smartform will be downloaded in .XML format to a
specified location.

Uploading of Smartform
1. Go to Smartforms transaction. To upload smartform , enter the
smartform name in Form
field and select Utilities->Upload Form.
2. You will get a popup to specify .XML file . Specify the file name from
which you want to create a smartform.

 SAP AG 2005, 31
Smartforms - Advantages
Smartform offers following advantages :


Creating and maintaining forms require half the
time.

Adapting to forms without any programming
techniques due to GUI.

Web publishing using generated XML output.

High performance when printing in large quantities.

 SAP AG 2005, 32

You might also like