You are on page 1of 44

*SMARTFORMS*

Overview

SMART FORM

❖Smart form is a GUI Tool which is used to design


the business legal documents such as Delivery
note,Purchase order,Invoice etc.

❖The transcation code is SMARTFORMS

❖Smartforms are client independent

❖It is advanced version of scripts

❖It is basically a GUI tool for user friendly maintenance

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 2
Differences b/w scripts & smartforms

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 3
Differences b/w scripts & smartforms

Sapscripts
Sapscripts are clinet dependent.

main window is compulsary.

No function Module will be generated.

sapscripts allows only black and white texts.

Sapscripts has repeated transfer of control.

Only single PageFormat is possible

Windows are: main, var, graphical windows in sapscripts.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 4
Differences b/w scripts & smartforms

Smartforms
Smartforms are client independent.

main window is not compulsory.

Smartforms generates a function module when activated.

Smartforms texts can be written in various colors.

There is no transfer of control b/w prg. and form in smartforms.

Once the control is transferred to FMOD, it will not come back to


driver prg.

Windows are: main, secondary, copies and final windows in


smartforms.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 5
COMPONENTS OF SMARTFORMS

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 6
SAP Smart Forms Components

COMPONENTS OF SMARTFORMS:-

There are two main nodes in Smartforms.

1.Global Settings

→Form Attribute

→Form Interface

→Global Definition

2.Pages and Windows

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 7
Global settings:

It is used to provide the basic settings for the smartform.

Form Attributes: It specifies the general attributes like

who created,Date,time,

package,translate options,

default smartstyle,

Page format (DINA4/DINA5)

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 8
Form interface: it acts as a mediator between a driver program and a
smart form.

The main functionality of form interface is, it will import the


parameters which are exported by driver program..

The parameters can be variables, work areas, internal tables..etc.

Global definition: it will contain the variables to be used within the


smart form.

We can define variables, user defined data types, field symbols,


initialization code,Subroutine, currency/quantity fields.

It is mainly used for declaring or defining the above variables.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 9
COMPONENTS OF SMARTFORMS
Pages and Windows

→page

→Window

→Graphic

→Address

→Text

→Table

-- Header

-- Body

© SAP AG 2001, Smart Forms - the Form Printing Solution,


-- Footer
Claudia Binder / Jens Stumpe 10
COMPONENTS OF SMARTFORMS

→ Template

→Folder

→ Program Lines

→Alternative

→Command

→Loop

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 11
Pages and windows

This will contain all the pages and the windows, which are used in
the smartform.

By default, a page will be created by name %page1.

By default, a window will be created by name ‘MAIN’ under the


page1.

For each page, we need to specify the next page

Eg: page = %page1

Next page = %page1 or %page2

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 12
Nodes under pages

Page : It is used to define the layout of a smartform.

We can have different pages with different layouts.

Window : it is used to display information or text at a particular place


on a page.

Graphic : it is used to display logos or images on the smartforms.

Address : it is used to display the address of customer or vendor or


employe, organization address , workplace address etc.

Just provide address no, it will automatically display the address as


per the country formats.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 13
Nodes under the window

Text : it is used to display the information or text in a window.

Table : it is used to display the information in the form of table.

When ever we create table by default HEADER, MAIN AREA,


FOOTER will be displayed.

The main functionality of a table is, it expands automatically


depending on the internal table data.

We need to provide the name of the internal table for a table.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 14
Template : template is also like a table which does not expand. That
means it will have fixed number of rows and columns.

Program lines : it is used to write some lines of abap code.

Alternative : it is used to provide alternative conditions like true or


false.

It is like IF…..ELSE……ENDIF in abap.

Loop : it is used to loop an internal table.

Command : it is used to trigger an external event to call a new page.

Folder : it is a container which is used to group all the subnodes.It is


like a folder in normal language

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 15
Window Types

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 16
Window Types

Various window types

◼ Main window: For continuous output .


◼ Secondary window: For output with a fixed length
◼ Final window: Special type of secondary window for
outputting the information that is not known until the
end of form processing
◼ Copies window: Special type of secondary window for
marking pages as copy or original.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 17
SMART STYLES
These are used to create the paragraph formats and character
formats

The main advantage of using smartstyles is ‘REUSABILITY’

That means, Once you create a smartstyle, we can reuse the same

Smartstyle in multiple smartforms.

The Tcode is SMARTSTYLES

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 18
Steps To Create SmartForm

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 19
Steps To Create SmartForm

❑ Goto ‘SMARTFORMS’ Tcode.

❑Give the form name as ‘ zsmartform’.

❑Click on Create.

❑Expand Pages and Windows

❑Right Click on Main Window.


→Create
→Text
Write the Text as ‘ This is Smartform Demo’.

❑SAVE ,ACTIVATE AND TEST IT.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 20
CREATING DRIVER PROGRAM FOR
◼ SMARTFORMS

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 21
SAP Smart Forms

◼ WHY SMARTFORMS ARE CLIENT INDEPENDENT?

Whenever a smartform is activated a function module will be


generated which contains the entire source code of the smartform.

Since function modules are client independent ,SAP Smartforms


are also client independent.

❑ HOW DO YOU FIND SMARTFORM FUN.MOD NAME STATICALLY?

Create a Smartform.

SAVE AND ACTIVATE.

Click on Environment
Function module name.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 22
SAP Smart Forms

HOW DO YOU FIND SMARTFORM FUN.MOD NAME DYNAMICALLY FROM


PRG?

◼ USING FM: SSF_FUNCTION_MODULE_NAME

It is a function module which is used to find out the dynamically


generated fuction module of a smartform.

Note: Whenever we move the smartform from one server to another


server with in a system landscape ,The smartform function module
name will change dynamically.

So use,SF_FUNCTION_MODULE_NAME and find the dynamically


generated fuction module of a smartform.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 23
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZINVOICE‘(Formname)
IMPORTING
FM_NAME = FM_NAME.(dynamically generated FM)

CALL FUNCTION FM_NAME

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 24
CREATING DRIVER PROGRAM FOR SMARTFORMS

➢Goto SE38 TCODE.

➢Create a program by name ‘ZDP_SMARTFORM’.

➢Write below code in the program.

DATA: LV_FNAME TYPE RS38L_FNAM.

CALL FUNCTION ‘SSF_FUNCTION_MODULE_NAME’


EXPORTING
FORMNAME = ‘ZSMARTFORM’
IMPORTING
FM_NAME = LV_FNAME.
Call function LV_FNAME.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 25
Passing data between Driver program and smartform

❖ Create a variable in the Driver program as below.


DATA : V_NAME(20) TYPE C.
V_NAME = ‘INVOICE’.

❖Import the variable in the smart form.


❖i.e., Goto Form interface and declare the variable as below

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 26
Passing data between Driver program and smartform

❖ Create a Text and Display the Variable

❖Name is &V_NAME&.
❖Date is &SFSY-DATE&
❖Time is &SFSY-TIME&

Save & Activate the Smartform .

❖Change the Driver Program as Below.

CALL FUNCTION ‘LV_FNAME’


EXPORTING
V_NAME = V_NAME.

❖ SAVE,ACTIVATE AND TEST IT.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 27
USING IMAGES IN SMARTFORM

STEP1: Upload the image through SE78 Tcode


STEP2: →Open the smartform
→Right Click On Page1 →Create →Graphic
→Provide the details as below.

→Adjust the size in Form Painter.


→Save,Activate and Test it.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 28
DISPLAYING ADDRESS IN SMARTFORM
→ Open the smartform

→Right Click On Page1


→Create
→Address
→ Provide the details as below.

→Adjust the size in FormPainter.


→Save,Activate and Test it.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 29
USING TEMPLATES IN SMARTFORM

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 30
USING TEMPLATES IN SMARTFORM

❖Template is a node which has a fixed layout i.e. fixed no. of rows
and columns.

❖Templates are same as table i.e. Templates will not expand whereas
Tables expand dynamically with no. of records.

❖Right Click on WINDOW

→Create

→ Template

❖A icon will be displayed as below.

%Template

❖Similarly, line type %C1 is also displayed

❖Specify the no. of Rows and Columns for line type%C1

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 31
USING TEMPLATES IN SMARTFORM

❖Click on Pencil Icon and Divide %c1 into 3 Columns and 2 rows

❖Provide the Frame for the Template as below.

❖Select all Cells or Boxes

❖Click on select pattern Icon

❖A Popup is displayed .

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 32
USING GLOBAL DEFINITION AND
PROGRAM LINES

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 33
USING GLOBAL DEFINITION AND PROGRAM LINES

❖Double click on global definitions in a smartform.

❖Declare a variable as below.

❖Right click on main window


→Create
→ flow logic→Program lines

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 34
USING GLOBAL DEFINITION AND PROGRAM LINES

❖Write the below ABAP Code in program lines

❖Write the below abap code.

V_NAME = ‘INVOICE SMARTFORM’.

❖Right Click on Programlines


→Create
→ Text.
Customer name is : &v_name&

❖Save, Activate and Test it.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 35
USING FOLDERS IN SMARTFORMS

❖Right Click on MAIN Window


→Create
→ Folder

❖Drag and Drop a Text or ProgramLines or Condition on to the


folder.

❖SAVE,ACTIVATE .

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 36
USING TABLE,TYPES AND CODE
INITIALIZATION

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 37
USING TABLE,TYPES AND CODE INITIALIZATION
❑TABLE::
❑ It is a node which displays data in form of a table,
❑ The table expands dynamically depending upon the data.
❑ Whenever we create a table HEADER,MAINAREA,FOOTER will
be created automatically.
❑ We need to specify the columns for
HEADER,MAINAREA,FOOTER.
LINETYPE::
❑ It is an option which is available in the table to specify the
number of Columns in a line.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 38
USING TABLE,TYPES AND CODE INITIALIZATION

Click on pencil button and divide the linetype into 4 columns


Right Click on a header
→Create→Table line
Specify the LINE TYPE as ‘%LINETYPE1’.
Automatically 4 Columns(Cells) will be displayed.
Right Click on each cell
→Create
→Text and specify text as below
Cell1 → Customer Number
Cell2 →Land1
Cell3 →City
Cell4 → Pincode
Smilarly assign the LINE TYPE for MAIN AREA and FOOTER.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 39
USING TABLE,TYPES AND CODE INITIALIZATION

❖Specifying Inernal Table and Work Area.

➢ Double Click on the Table


➢ Goto Data Tab

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 40
USING LOOP IN SMARTFORMS

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 41
USING LOOP IN SMARTFORMS
LOOP:
❖ LOOP is a node which is used to loop an internal table.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 42
DEBUGGING OF SMARTFORMS

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 43
DEBUGGING OF SMARTFORMS

There are two ways to Debug the smartforms

❖By putting the static breakpoint in programlines of a


smartform.

❖By putting a dynamic break point ina function module.

© SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 44

You might also like