Está en la página 1de 50

February 2010

SMARTFORMS Training

Alberto Toquero Puerta


Index

1. Introduction

2. Smart Form Components - SAP Smart Form Builder

3. Smart Form Components - SAP Smart Function Module

4. Smart Form Components - SAP Smart Print Program

5. Smart Form Styles

6. Text modules

Copyright NorthgateArinso. All rights reserved.


1. INTRODUCTION

Copyright NorthgateArinso. All rights reserved.


What are Smart Forms?

SAP Smart Forms is a tool for the maintenance of forms on which application
data from the SAP system can be output.

Depending on the application, the number of forms to be printed can be very


high, and they might have to be printed in a short period of time, in a mass
printing.

Examples of mass printing are payslips, contracts, etc.

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.

Copyright NorthgateArinso. All rights reserved.


SAP Smart Form Process Overview

The basic structure of SAP Smart Forms consists of:

the Smart Form Builder,


the Smart Form function module, and
the Smart Form print program (also described as a driver program).

Remark: The Smart Form print programs are not the same as SAPScript
programs, and you cannot use a SAPScript print program with a Smart Form
print form.

Copyright NorthgateArinso. All rights reserved.


Smart Form Architecture Diagram

Copyright NorthgateArinso. All rights reserved.


2. Smart Form Components
SAP Smart Form Builder

Copyright NorthgateArinso. All rights reserved.


SAP Smart Form Builder

The main SAP Smart Form interface is the Smart Form Builder.
Call this transaction by entering the transaction code smartforms in the
Command field.
The initial screen allows you to enter the name of the form you want to
modify or copy, or you can create a new form.

Copyright NorthgateArinso. All rights reserved.


Copyright NorthgateArinso. All rights reserved.
Smart Form Builder Screen

The three frames of Smart Forms Builder screen are the:


Navigation menu: This frame 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
your Form Painter is not visible on the screen, choose Form Painter.
You can control whether the Form Painter is visible or hidden using this
button.

Copyright NorthgateArinso. All rights reserved.


Navigation Menu

There are two main groups of elements in the Navigation Menu section.

Global Settings folder: this folder contains the attributes and preferences
of the form.
Furthermore, it is necessary to define parameters, variables, work areas
and tables we want to use in the processing.

These elements can be found or defined in the following section:


Form attributes,
Form interface, and
Global definitions.

Pages and Windows folder: this folder will contain all the designs,
frames, texts, codes, tables and graphics (and more) for the pages
of a Smart Form.

Copyright NorthgateArinso. All rights reserved.


Global Settings Folder
Form atributes : This section determines, the languages (traslations) of the
Form, the page format, ( DIN A4, letter, DIN A3, etc, ...), characters, lines per
inch and style. These formats are used in the general output of the Form.

Remark: We will see later where these formats can be changed.

Copyright NorthgateArinso. All rights reserved.


Form interface : In it you will find the parameters of the function that execute the
Form.
The SmartForm proceeds like a FM, so you can adapt it to your requirements, i.e.
passing internal tables, and returning any other variable you need.

Remark: By default, some parameters are created automatically in tabs Import, Export
and Exceptions.

Copyright NorthgateArinso. All rights reserved.


Global definitions : this is the section where you can define your
internal tables, work areas and variables to use locally in your Form.

Furthermore, it is possible to define new types, field-symbols and also a


part of code that will be processed before the Form. (Initialization).

Copyright NorthgateArinso. All rights reserved.


Pages and Windows Folder

PAGES: They define the format and characteristics of each page of


the Form.

Each page must indicate the next page that will be processed after
the current one.

Copyright NorthgateArinso. All rights reserved.


You can also define a specific format for the page.

And you can select a background picture for the page.

Copyright NorthgateArinso. All rights reserved.


Pages and Windows Folder
WINDOWS: They are output areas for the data. You can define the size and
position graphically using the Form Painter.

There are Main Windows and Secondary Windows. The big difference
between them is that the output of a Main Window could be several pages
Large.

Copyright NorthgateArinso. All rights reserved.


As soon as a page is full, SAP Smart Forms automatically triggers a
page break.

A page is full as soon as all output areas on this page are filled.
Output to all output areas, except the main window, is truncated as
soon as the area is full.

The main window is the only output area whose window contents
can spread over several pages. This is again solved by an automatic
page break. In addition, SAP Smart Forms allows you to set a
dynamic page break in order to start a new draft page (for example,
to print the terms of business as the last page).

We will see the dynamic page break in the Command node.

Copyright NorthgateArinso. All rights reserved.


Once the size and position of a window has been set, you can see its attributes
in the Maintenance Frame. Tab Output Options.

Copyright NorthgateArinso. All rights reserved.


Conditions tab:
Each window (and individually, each node inside them) can be
conditioned by logical operations. If this condition is not true, the
page will not be processed.

Copyright NorthgateArinso. All rights reserved.


Smartforms Elements
The Smart Forms elements are used to convert the data and to display the
data in different ways.

Copyright NorthgateArinso. All rights reserved.


Loop

It works like ABAP loop. You can define de WHERE conditions in the
same way and Sort Criteria, to Sort the table before the loop
statement.

Copyright NorthgateArinso. All rights reserved.


Alternative

It works like an IF sentence in ABAP code. The condition determines


which branch of code will be processed.

Copyright NorthgateArinso. All rights reserved.


Program Lines
ABAP code. The functionality is like a SAP Function Module.

You have to indicate the Input and Output parameters. Even using
the variables created in the section Global Definitions.

You can also define your local variables and types, and call other
FMs, and use tables of the Master Data.

Copyright NorthgateArinso. All rights reserved.


Command

You use a command to stop the output of a page in the main


window.

In the main window, create a command node in the navigation tree


of the Form Builder.

The output of the main window continues on the new page, starting
with the first directly inferior node of the new draft page. In the main
window, SAP Smart Forms continues printing after the command
node that triggered the page break.

Copyright NorthgateArinso. All rights reserved.


Remark: Commands are used also for special actions like paragraph
numbering, printer control.

Copyright NorthgateArinso. All rights reserved.


Graphic

This node is used to display graphics, i.e. company logo, on the


Form.
You can use a variable for the name of the image. Just set the name
between & (this is used to specify that the value is a variable).

Copyright NorthgateArinso. All rights reserved.


To upload / manage your images and graphics, you will have to use
the Administration of Form Graphics (transaction SE78) to import
graphics into SAP System

Copyright NorthgateArinso. All rights reserved.


In the example above, the variable Logo has been calculated using a
Program Lines node, searching in euHReka table Y00BA_TAB_LOGO.

The Graphic node has a condition (conditions tab) to check if the variable is
not equal to the empty string, in order to avoid error messages.

Copyright NorthgateArinso. All rights reserved.


Text

The text node is used to display statics text or variables in the Form.
By default, the format of the text is the same as defined for the
general Form, but it is possible change it.

To use a variable in the output, you have to use a Field. This is the
variable between special character &.

The can add the fields using the icon

Copyright NorthgateArinso. All rights reserved.


Table Output - Template

The template is one of the nodes used to display a table in the


Form.

It is static, so you will have to set the number of rows, columns and
their size.

Copyright NorthgateArinso. All rights reserved.


The button Details open a new frame in which you can define the size for the
rows and the columns.

Remark: Be careful with the columns width. If the total lenght for the columns
is not exactly the same that whole table width, it will give an error.
Furthermore, if the text/data is greater than the column, no data will be
displayed.

Copyright NorthgateArinso. All rights reserved.


To display content in cells, you must create nodes under the
template node.
The inserted nodes has a Output Options tab, with an additional box
Output structure with the fields Line and Column. Assign each node
to the cell in which you want the output to appear.

Copyright NorthgateArinso. All rights reserved.


Table Output - Table

The table is the other element used to display a table in the Form.

It is not static,.the size of the table depends on how much data the
application program passes to the form at runtime (unlike with
templates, where you specify the number of columns and lines
explicitly). The table can cover one or more pages, depending on the
number of lines. This is why you display tables in the main window.

Copyright NorthgateArinso. All rights reserved.


For table output SAP Smart Forms divides a table into a header, a
main area, and a footer. These output areas of the table
automatically appear as directly inferior nodes of the table node in
the navigation tree.

The output areas Header, Main Area, and Footer are used to print
the table heading, the actual table items, and the results (for
example, a grand total) in the table.

Copyright NorthgateArinso. All rights reserved.


This 3 special nodes can contain child nodes.
The new one for us is the Table Line. It allows us to display the
information in a correct table structure.
The Line Type is created in the tab Table when we create a new
table node.

Copyright NorthgateArinso. All rights reserved.


In the header and footer areas you can access the data of your
internal table only at their respective output events (see print time
above).

In the main area you can access it at every loop pass.

Copyright NorthgateArinso. All rights reserved.


3. Smart Form Components
SAP Smart Function Module

Copyright NorthgateArinso. All rights reserved.


Function Module

The Smart Form function module is the code generated


automatically when you activate your Smart Form print form.

Each time you make a change to your print form in the Smart Form
Builder, the change needs to be activated in the Smart Form Builder
before taking effect in your output.
To see the function module created, just Test (F8) the Form in the
SAP Smart Forms: Initial Screen.

Copyright NorthgateArinso. All rights reserved.


To access the code of the nodes of the Form, we can go to the Main
Program of the function module.

Copyright NorthgateArinso. All rights reserved.


Then, we can navigate inside the User-defined Include-files.

Copyright NorthgateArinso. All rights reserved.


This can help us to debug our Form. It is very easy to follow up the
elements and code of the Form.

Copyright NorthgateArinso. All rights reserved.


4. Smart Form Components
SAP Smart Print Program

Copyright NorthgateArinso. All rights reserved.


Creating a report to call the Form

The Smart Form Print Program can be a report where we call the
function module of a Form.

First, we will retrieve the FM name. This is possible using FM


SSF_FUNCTION_MODULE_NAME and passing the Form name.

Copyright NorthgateArinso. All rights reserved.


After that, we can call the FM_NAME parameter returned.

We must call the FM_NAME using the parameters added to the


Form in the Form Interface section, in Global Settings.

Copyright NorthgateArinso. All rights reserved.


5. Smart Form Styles

Copyright NorthgateArinso. All rights reserved.


Smart Form Styles

Copyright NorthgateArinso. All rights reserved.


The Smart Form Styles is a application to define or change new
paragraph and character formats for the forms.

Copyright NorthgateArinso. All rights reserved.


6. Text modules

Copyright NorthgateArinso. All rights reserved.


Text modules

Instead of use a normal text in a Text node, you can use a Text module.
This allows you to easily use texts from one text module in several forms. In
addition, it is not necessary to load the entire form description to maintain
these texts.

Copyright NorthgateArinso. All rights reserved.

También podría gustarte