Smartform Form Layout Creation TCode - SMARTFORMS PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

To Create Form Layout for Smartforms we need to create new form using SMARTFORMS tcode.

Step by Step details as below:


A) Global Setting :
1) Form Attributes: In this attributes, all system details are updated. User can select the Page
Format, Style, and Output Format.

2) Form Interface: In this tab parameter details are provided, Import, Export parameters.
Import Parameter: Developer need to provide parameters which will be output of driver
program. Same parameters will be used for creating Smartforms.

Export Parameters: We need to provide export parameters. Normally we dont need to provide
export parameters as it is used for print or output purpose.

Table : Need to provide internal tables which need to be used , associated type should be
defined in SE11 Table Defination . As in smartforms , only TYPE option is available for
type assignments.

3) Global Definition : In this developer need to define all the variables , work area and Internal
table , Local structure definitions , Field symbols, currency/ Quan fields which will be used in
smartforms.
- Global Data : Developer need to add all the variable , work area and Internal table. Note
for internal table associated type should be defined as Table type in SE11.

Types : Developer need to define structure types in this tab.

Field Symbols: This is used to define field symbols ,used in OOPS.

Initialization : In this tab, developer need to write global code which can be used to work on the
data transferred from Driver program.
Input Parameters : Need to define all the input parameters required to execute code.
Output Parameters : Need to define all the output parameters required to execute code. Code need
to be written in text area , as per below screen shot.

Currency/Quant Fields : Need to define all the currency / Quantity fields to be used in this
smartforms.

B) Pages and Windows (Layout creation): In this section developer can design Smartforms as
per business needs. We can create Pages, Windows, Graphics and Address fields.
There are four types of window that can be created:

Main Window: It contains all the information which we need to display. Most of the times
Data is dynamic in main window. We can define only one Main window in a page. We can
create: Text, Table, Template, Flow Logic, Address window, Graphics, Address.

Graphics Section: As per business requirements user can assign image in graphics section. Normally
this used to display company logo or plant address (to reduce the

space)

Address: Smartforms gives the option of giving the address number which is maintained in the
central address management. The address will be directly taken from ADRC table and will be
populated
form.

in

the

Table Painter: In Table painter, you can draw the format as per client requirement (e.g. Heading,
Sub Heading, Item, Sub Total, Grand Total etc.). In simple words Table = Loop + Template
you can use the table layout to determine:

The number of lines and cells

The height of each line

The width of each cell

The alignment of the table in the window

Table extends dynamically.

Table contains dynamic data.

The Table shows the different line types which will be used in the table. The Line types define the
size of each cell and the number of cells in each line.
Table has 3 sections, HEADER, ITEM, FOOTER the header section will be executed once and it
will loop at the item level, and at the end footer will be executed.

ails

Sections in table:
- Table: In this section line type is defined. which will be used while defining sections in
Header , Main area and Footer. Details > Field details section

- Data: In this developer need to provide details of Internal Table and Work area

- Calculations: If we need to display total , we need to provide operations which need to be


executed , field details , Target field details and when this activity need to be executed.

Main Window Section :

We need to add Row for Header , Main Area and Footer Area.
In each section we need to provide Line type which need to be displayed in

Template:

Template is a predefined format which you can design in the smartform like a ruled note
book.Developer can graphically create no of rows and columns u want

it is static

You can create a template in any window you want.

For putting any value in that u have to create text under the template and mention the position
where the text will appear.

In Text we can define in which that data to be displayed. Text > Output Options > Output
Structure > Line and Columns

Header:Static field labels are provided in text fields of Header section.

Main Area: This section is updated dynamically as per the data fetched from database. Values in
main area are dynamic.

Footer Section :This section normally used to display total values , total values or number of line
items. We can add conditions in all the windows, if condition is satisfied then this section will be
displayed or it will not be displayed. Similar to IF ... END IF Condition.

Secondary Window: Size of secondary window is always fixed. If data extends beyond the size of
secondary window then it will be truncated. Normally Secondary window section is used to display
address, final total, company logo or T&Cs.

Final Window: Developer cannot add any other window after final window is defined on that page.

System Fields for SMARTFORMS

System fields of Smart Forms


&SFSY-DATE&
Displays the date. You determine the display format in the user master record.
&SFSY-TIME&
Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE&
Inserts the number of the current print page into the text. You determine theformat of the page
number (for example, Arabic, numeric) in the page node.
&SFSY-FORMPAGES&
Displays the total number of pages for the currently processed form. Thisallows you to include texts
such as'Page x of y' into your output.
&SFSY-JOBPAGES&
Contains the total page number of all forms in the currently processed printrequest.
&SFSY-WINDOWNAME&
Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME&
Contains the name of the current page (string in the Page field)
&SFSY-PAGEBREAK&
Is set to 'X' after a page break (either automatic [Page 7] orcommand-controlled [Page 46])
&SFSY-MAINEND&
Is set as soon as processing of the main window on the current page ends

&SFSY-EXCEPTION&
Contains the name of the raised exception. You must trigger your ownexceptions, which you defined
in the form interface, using the user_exception macro
Flow Logic

Alternative : In Alternative, we will give some condition. if the condition is true, only the elements within
true node will be executed if its false only the elements within false node will be executed..
Example :
After creating Alternative your form will look like this

In General Attributes of the alternate give condition COUNTRY = 'IN' as shown below

Right Click on True and create text and write some text in that, likewise create text and write something for
false condition also. Now our screen will appear as shown below

(In this case I have written Alternate Condtion True Country is India for the text in true condition and
Alternate Condtion True Country is India for text in false condition)

Loop : Loop can be used in any window , it is not limited to Main Window alone. Give a descriptive
name to the Loop Description text area.
On the Data tab of the Smartform Loop element, define the loop for each IT_VBAK row as follows.
On every turn of the defined loop, move each loop item into GS_VBAK vbak globalstructureor VBAK
work area item.
Also set the Row range from 1 to a logical number for example 9999, etc.

Now we willcreatea data section which will show the SAP sales document number and the detail
items of the VBAK row which maps to SAP VBAP records of the related VBAK header data.
First of all, we willcreatea text element under the Loop element node.
This text element will display the VBELN sales document number for each record of it_vbak selected
in the loop.
Then we will add a table element in order to display the items of the loop item.
The last Smartform element which we willcreateon this Smartforms example document is Command
element.
We will use the Command element in order to set page break between two vbak header records.
Below is the screenshot that the SAP Smartform elements of this example Smartforms.
Note that the descriptions of the Smartforms elements are given due to their respective tasks.

Program Lines: In this section developer has to write program lines as per business requirements.
Developer has to provide input parameters and output parameters, as this fields are mandatory.

Command: This section is used to add control break statements.


Ex; in some cases user will ask only specific number of records should be displayed per page, but
based on space availability of main window data will populate. To restrict manually the number of
records displayed per page we can use COMMAND.

Developers have to write comparison value field and value in condition tab.

Auxiliary Nodes in SMARTFORMS


1) Table: O/p of a table containing application / dynamic data.
2) Template: o/p of a table containing static data.
3) Program Lines: Executes ABAP code.
4) Folder: Combines successor nodes to logical group.
5) Loop: Processes successor nodes repeatedly.
6) Alternative: In Alternative, programmer can give some condition. If the condition is true, only the
elements within true node will be executed if its false only the elements within false node will be executed..
7) Commands: Executes special commands.

You might also like