0% found this document useful (0 votes)
75 views27 pages

Smartforms For Beginners

Uploaded by

Pari Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views27 pages

Smartforms For Beginners

Uploaded by

Pari Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

11/30/21, 11:11 AM Smartforms for Beginners

SAP ABAP » SAP ABAP Tutorial

Smartforms for Beginners

Company Registration
Online company registration with all related registration starting from just Rs.6899/-
Open
IndiaFilings

Smartforms

Objective

The objective of this section is to introduce Smart Forms. The topics covered include :

Features and advantages of Smart Forms .


Architecture.

Tools in Smart Forms.


Developing a smart form, smart style and linking it to a program.
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

Multiple page formats possible in smartform


Main window may not be there in smartform
Labels cannot be created in smartform (disadvantage)
Routines can be written in smartforms
Smartform creates a function module when activated

Advantages

Creating and maintaining forms requiring half the time


Adapting forms without any programming knowledge due to entirely graphical user interface

https://www.stechies.com/smart-forms-beginners/ 1/27
11/30/21, 11:11 AM Smartforms for Beginners

Web Publishing using the generated XML output

Smart forms execute faster than Sap Script

Features

SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using
simple graphical tools.

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

For Web publishing, the system provides a generated XML output of the processed form.
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.

SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as
background graphics.

Global Settings

Global settings in a smart form consist of :

Form Attributes
Form Interfaces
Global definition

Form Attributes

In the form attributes we define the print settings like :

The page format (eg: DINA4, DINA3 etc.)


Characters per inch
Lines per inch
Style (Smart Style / System style)
Flag for XSF output

https://www.stechies.com/smart-forms-beginners/ 2/27
11/30/21, 11:11 AM Smartforms for Beginners

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.

https://www.stechies.com/smart-forms-beginners/ 3/27
11/30/21, 11:11 AM Smartforms for Beginners

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.

General Concepts on Form Printing

They find use in :

Order confirmations

Invoices

Account statements

Cheques

Salary statements

Delivery notes

Customs forms

Industry-specific forms

Form printing covers creating and maintaining a form for mass printing in SAP Systems
The layout determines the page structure, that is the number of differently structured pages and the
positions of the output areas on these pages.
The form logic controls the dynamic formatting of the form.

https://www.stechies.com/smart-forms-beginners/ 4/27
11/30/21, 11:11 AM Smartforms for Beginners

Structure of the 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 content

Pages of a form

On the pages of a form you determine the page layout and the sequence of pages with different
structures.
The individual pages in the form may differ in their structure.

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.

Start Audiophile Journey


Headphone Zone

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

https://www.stechies.com/smart-forms-beginners/ 5/27
11/30/21, 11:11 AM Smartforms for Beginners

Text and Data in a Form

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

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 retrieva

https://www.stechies.com/smart-forms-beginners/ 6/27
11/30/21, 11:11 AM Smartforms for Beginners

How does a smart form 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.

Creating Smart Forms

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.

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

https://www.stechies.com/smart-forms-beginners/ 7/27
11/30/21, 11:11 AM Smartforms for Beginners

routines.

Describing the form

Describe the interface of the form. It results from the application data previously selected.

Create one or more pages. On a page, you can position windows, addresses, and graphics. Within a
window, you can create additional elements.

PRICE DROP PRICE DROP PRICE DROP

World's Best Brands


Headphone Zone

Create elements (text, graphics, tables, and so on) for each page, using other tools of the Form
Builder:

Use the Form Painterto position windows, graphics, and addresses on a page (the
other elements are displayed in an assigned window).
Use the PC Editorto write your texts.
Use the Table Painterto 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:

https://www.stechies.com/smart-forms-beginners/ 8/27
11/30/21, 11:11 AM Smartforms for Beginners

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 root node. The successorsof 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).

Nodes in Smartforms

Page
Window

https://www.stechies.com/smart-forms-beginners/ 9/27
11/30/21, 11:11 AM Smartforms for Beginners

Text
Graphic
Template
Table
Command
Loop
Alternative
Folder
Complex Section
Program Lines

Node Types -Overview

Output Areas

Elementary nodes (without successors)

Table output

Flow Control

https://www.stechies.com/smart-forms-beginners/ 10/27
11/30/21, 11:11 AM Smartforms for Beginners

Other Nodes

Tools in smartforms

Form Painter
Table Painter
PC Editor
Navigation Tree

Form Painter

Used to design the layout of the smartform


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

Table Painter

https://www.stechies.com/smart-forms-beginners/ 11/27
11/30/21, 11:11 AM Smartforms for Beginners

Drawing rows and columns


Inserting , cutting ,copying and deleting lines
Deleting cells
Splitting cells
Selecting table patterns
Changing cell size and moving cell separator lines

PC Editor

Enter, delete, select, cut, and copy texts


Assign paragraph and character formats

Include, change, and delete fields

https://www.stechies.com/smart-forms-beginners/ 12/27
11/30/21, 11:11 AM Smartforms for Beginners

Style Builder

Use Transaction Code SMARTSTYLES to maintain paragraph and character formats.

A Smart Style contains

- Header data containing the default values of a Smart Style

बैंक खाता खोलने

के लिए घर से बाहर

खोलें
निकलने की जरुरत

नहीं है 811 के साथ


Kotak 811

Paragraph formats including indents and spacing, font attributes, tabs, and outline and numbering
Character formats including effects (superscript, subscript), bar-code and font attributes

Colors and underlines for a paragraph or character format


Preview

https://www.stechies.com/smart-forms-beginners/ 13/27
11/30/21, 11:11 AM Smartforms for Beginners

Field List and Error list

Field List

ListThe field list displays:

All tables, structures and fields passed via the form interface.

System field and fields defined in the global definition

Error List

When we check the smart forms and if any error occurs, it will be displayed at the bottom

of the maintenance screen

https://www.stechies.com/smart-forms-beginners/ 14/27
11/30/21, 11:11 AM Smartforms for Beginners

Example

We will be using a smart form to print the details of a Sales order with details like :

Company address

Customer address

Material Number and description

https://www.stechies.com/smart-forms-beginners/ 15/27
11/30/21, 11:11 AM Smartforms for Beginners

Quantity and total price

priceSales order value.

For the sake of the example, both loop and table nodes are used for printing the item details.

The following slides show the required output and the components of the Form Builder used for
getting the same.

Example -With Loop

Development Sequence

https://www.stechies.com/smart-forms-beginners/ 16/27
11/30/21, 11:11 AM Smartforms for Beginners

https://www.stechies.com/smart-forms-beginners/ 17/27
11/30/21, 11:11 AM Smartforms for Beginners

https://www.stechies.com/smart-forms-beginners/ 18/27
11/30/21, 11:11 AM Smartforms for Beginners

https://www.stechies.com/smart-forms-beginners/ 19/27
11/30/21, 11:11 AM Smartforms for Beginners

https://www.stechies.com/smart-forms-beginners/ 20/27
11/30/21, 11:11 AM Smartforms for Beginners

Example -With Table

https://www.stechies.com/smart-forms-beginners/ 21/27
11/30/21, 11:11 AM Smartforms for Beginners

Table Painter

Source Code

REPORT ZSALES_PRINT NO STANDARD PAGE HEADING.

DATA FLAG(1).

https://www.stechies.com/smart-forms-beginners/ 22/27
11/30/21, 11:11 AM Smartforms for Beginners

DATA: FORM_NAME(30) VALUE 'ZSALES_PRINT'.

DATA: FM_NAME TYPE RS38L_FNAM.

PARAMETERS: VBELN LIKE VBAK-VBELN OBLIGATORY,KUNNR LIKE VBAK-KUNNR OBLIGATORY.

DATA: BEGIN OF ZITAB OCCURS 0. INCLUDE STRUCTURE VBAP.

DATA: END OF ZITAB.

DATA ZITAB1 LIKE ZITAB OCCURS 0 WITH HEADER LINE.DATA: SVBELN TYPE DDSHRETVAL.TABLES:
VBAK, VBAP.

START-OF-SELECTION.

SELECT SINGLE * FROM VBAK WHERE VBELN = VBELNAND KUNNR = KUNNR.

SELECT * FROM VBAP INTO CORRESPONDING FIELDS OF TABLE ZITABWHERE VBELN = VBAK-VBELN

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'EXPORTINGFORMNAME = FORM_NAME

*VARIANT= ' '

*DIRECT_CALL= ' '

IMPORTING

FM_NAME= FM_NAME

*EXCEPTIONS

*NO_FORM= 1

*NO_FUNCTION_MODULE= 2

*OTHERS= 3.

IF SY-SUBRC <> 0.

*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION FM_NAME

EXPORTING

VBELN = VBELN

https://www.stechies.com/smart-forms-beginners/ 23/27
11/30/21, 11:11 AM Smartforms for Beginners

KUNNR = KUNNR

FLAG= FLAG

ZITAB= ZITAB

ZITAB1 = ZITAB1.

Summary

The previous slides explained the features, creation and the application of Smart Forms.

Recommended Posts:

What is SAP ABAP?

ABAP Data Types and Objects


SAP ABAP System Variables

ABAP Internal Tables

ABAP Table Control


ABAP Data Dictionary

ABAP Views Types

SSCR Key in SAP ABAP


ABAP Script Commands

ABAP Menu & Screen Painter

ABAP Search Help


ABAP Lock Object

ABAP OOP's

ABAP Smartforms

https://www.stechies.com/smart-forms-beginners/ 24/27
11/30/21, 11:11 AM Smartforms for Beginners

ABAP WEB DYNPRO

ABAP SAPScript
ABAP User Exits, Customer Exits and BADI

SAP ABAP PBO and PAI

ABAP Core Data Service


SAP ABAP Interview Questions

Follow Us

Contact Information

#3940 Sector 23,

Gurgaon, Haryana (India)

Pin :- 122015

[email protected]

Top Tutorials

SAP Tutorial

SAP HANA Tutorial

SAP BASIS Tutorial

Android Tutorial

Python Tutorial

Java Tutorial

Hadoop Tutorial

Photoshop Tutorial

https://www.stechies.com/smart-forms-beginners/ 25/27
11/30/21, 11:11 AM Smartforms for Beginners

Difference Between Article

Interview Questions

Top Interview Questions

ABAP Interview Questions

BASIS Interview Questions

HANA Interview Questions

SD Interview Questions

FICO Interview Questions

Hibernate Interview Questions

QTP/UFT Interview Questions

Tableau Interview Questions

TestNG Interview Questions

Hive Interview Questions

Quick Links

Write for us

Career Guidance Tool

SAP Transaction Codes

Sample Resume

Institutes

SAP PDF Books

Classifieds

Recent Articles

Contact Us

About Us

Terms of Use

Privacy Policy

Cookies Policy

https://www.stechies.com/smart-forms-beginners/ 26/27
11/30/21, 11:11 AM Smartforms for Beginners
All the site contents are Copyright © www.stechies.com and the content authors. All rights reserved. All product names are trademarks of their respective
companies. The site www.stechies.com is in no way affiliated with SAP AG. Every effort is made to ensure the content integrity. Information used on this site is at
your own risk. The content on this site may not be reproduced or redistributed without the express written permission of www.stechies.com or the content authors.

https://www.stechies.com/smart-forms-beginners/ 27/27

You might also like