Вы находитесь на странице: 1из 47

AB1009 – Smartforms - v1.

India SAP CoE, Slide 1


Smartforms
1 Introduction

2 Syntax Description

3 Demonstration

4 Exercises

5 HelpMe
India SAP CoE, Slide 2
Smartforms
1 Introduction

2 Syntax Description

3 Demonstration

4 Exercises

5 HelpMe
India SAP CoE, Slide 3
Introduction

• Purpose
• Use

India SAP CoE, Slide 4


Purpose

Smartform is a template that simplifies the process


of designing business forms. You need smartform to
print, distribute or display business forms.
Smartform tool includes utilities for designing forms
and for defining the interface to the application
programs that use forms for data output. The output
of application data is placed into a dynamically
expandable table where the size and layout of the
output table is determined by the number of records
being retrieved.

India SAP CoE, Slide 5


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.

India SAP CoE, Slide 6


Smartforms
1 Introduction

2 Syntax description

3 Demonstration

4 Exercises

5 HelpMe
India SAP CoE, Slide 7
Syntax Description
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.

India SAP CoE, Slide 8


Smartform Development
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.

India SAP CoE, Slide 9


Smartform Initial Screen

India SAP CoE, Slide 10


Smartform Builder Components
Smartform screen is divided in following 3 components.

Navigation Menu Maintenance Frame Form Painter

India SAP CoE, Slide 11


Smartform screen components
• 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

India SAP CoE, Slide 12


Node Types Overview
Root Nodes
 Global Settings
 Pages and Windows.

Attributes
 General Attributes
 Output Options
 Conditions

India SAP CoE, Slide 13


Successors of Node Pages and Windows
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

India SAP CoE, Slide 14


India SAP CoE, Slide 15
Pages
• 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.

India SAP CoE, Slide 16


Main window and subwindows

• 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.

India SAP CoE, Slide 17


Subwindows

• 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.

India SAP CoE, Slide 18


Tables and Templates
• 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.

India SAP CoE, Slide 19


Table and Templates - Contd.
Template size is determined at design time in the Form Painter.

India SAP CoE, Slide 20


Text Type

Form Text types

Text elements
Text modules
Include texts
Dynamic texts

India SAP CoE, Slide 21


Parameterized Text
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’

India SAP CoE, Slide 22


Event and Conditions
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.

India SAP CoE, Slide 23


Global Settings – Integration with
application program
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

India SAP CoE, Slide 24


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.

India SAP CoE, Slide 25


Integrating the Smart Form with the
application program.
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.

India SAP CoE, Slide 26


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.

India SAP CoE, Slide 27


• 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.

India SAP CoE, Slide 28


Smartforms
1 Introduction

2 Syntax Description
description

3 Demonstration

4 Exercises

5 HelpMe
India SAP CoE, Slide 29
Configuration
- 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.

India SAP CoE, Slide 30


Smartforms
1 Introduction

2 Syntax Description
description

3 Demonstration

4 Exercises

5 HelpMe
India SAP CoE, Slide 31
Quick Overview of Node Usage
before starting with exercise

India SAP CoE, Slide 32


Exercises
Let us design one smartform for Billing Document. The layout
specifications and data retrieval logic has been explained in these
word documents.

Layout Specification :

Layout Specification

Data Retrieval Logic

Data retrieval for


billing document

India SAP CoE, Slide 33


Transactions
SMARTFORMS Create Smartform

SMARTSTYLES Create style

SO10 Create standard Text

SE38 Create print program

SE78 Upload Logo

India SAP CoE, Slide 34


Smartforms
1 Introduction

2 Syntax Description
description

3 Demonstration

4 Exercises

5 HelpMe
India SAP CoE, Slide 35
Tips and Tricks in smartform
Field List on / off

1. Debugging smartform

2. Adding variables in text


node

Field List

India SAP CoE, Slide 36


Additional – Interface parameters in detail

India SAP CoE, Slide 37


Additional – Interface parameters in detail…
continued

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

India SAP CoE, Slide 38


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.

India SAP CoE, Slide 39


How to migrate the SAP scripts to
Smartforms?
You can convert individual forms on the initial screen of the SAP
Smartforms transaction. Steps for migration are:
1. Enter the ‘smartforms’ in command node. It will take you to smartform
screen.
2. Enter the name of the SAP Smartform to be created in the Form field.
3. Choose Utilities at menu bar and select Migrate SAPscript form .

4. The program first tries to find the SAPscript form in the current client ; if
the form does not exist there the system looks in client 000.If you
choose Enter form is migrated.

India SAP CoE, Slide 40


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.

India SAP CoE, Slide 41


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.

India SAP CoE, Slide 42


How smartforms are different
than Sapscripts?
1. Multiple page formats are possible in smartforms
which is not the case in Sapscripts.
2. It is possible to have smartform without a main
window.
3. Routines can be written within smartform tool itself.
4. Smartforms generate a function module when
activated. Because of which smartform can be called
from any ABAP object type and thus increases
reusability.

India SAP CoE, Slide 43


Another Method to Debug a Smartform
Method 1.
• Goto SE37 and give the function module name of a Smartform.

• Open the Function Module

India SAP CoE, Slide 44


• Goto  Main Program 

India SAP CoE, Slide 45


It will display three includes:
• First Include will have the Global Data Declaration.
• Second Include will have the Form Interface.
• Third Include will have the Main Program.

India SAP CoE, Slide 46


• Open the third Include and set the Break-Point wherever necessary

Method2.
• In same way we can do it through transaction SE80.

India SAP CoE, Slide 47

Вам также может понравиться