Sie sind auf Seite 1von 12

SMARTFORM:

Smart forms are used to design the business documents such as purchase order, sales order,
invoice, Performa etc.
Smart forms are introduced from 4.6c version onwards. It also supports output mode as ‘EMAIL’.
Components of Smartforms:
1. Smart form layout.
2. Function module.
3. Print layout.
Components of the smartforms layout:
1. Global settings.
2. Pages and windows.
Components of Global settings:
1. Form attributes
2. Form interface
3. Global definition
Form attributes:
Form attributes contain header information i.e.,
Form name
Language
Page format
Created by…………..
Form interface: this is used to declare the variables, work area and internal tables which we need to
transfer the data from print program to layout.
Global definition: this is used to declare the variables, work-area and internal table which are used to
implement the logic in the layout.
PAGES: page is the physical area where we place the window. We can’t print the text in the page.
WINDOWS: we can place the same window in ‘n’ number of pages but we can’t print the data directly
on the window.
Procedure of Smart Form:
1. Based on the client requirement we design the smartform layout by using SMARTFORMS t-
code.
2. After activating the smart form it generates a function module.
3. Based on the function module we develop the print program.
NOTE: Printing the data on the page window is always through symbols.
There are four types of symbols.
1. Program symbols
2. System symbols
3. Standard symbols
4. Text symbols.
Each symbol starts with ‘&’ ends with ‘&’.
Differences between Sapscripts and Smartforms:
SAPSCRIPTS SMARTFORMS
1. Multiple page formats are not possible In 1. Multiple page formats are possible in
SAPSCRIPTS. SMARTFORMS.
2. SAPSCRIPT is client dependent i.e., that 2. SMARTFORMS are client independent.
means if you create the form in one client that That means form is available in all the clients
is not available in all clients. under the server if you create in any client.
3. Without a main window we can’t design 3. Without a main window we can design the
SAPSCRIPT. smartform.
4. Colors are not possible in SAPSCRIPTS. 4. Colors are possible in SMARTFORMS.
5. For complex coding we select the 5. For complex design we use the
SAPSCRIPTS SMARTFORMS
6. We can’t use the same paragraph and 6. We can use the same paragraph and
character formats more than once in a script. character formats for multiple MARTFORMS
layouts.
7. Labels are possible here. 8. SMARTFOR support all the
8. SAPSCRIPTS doesn’t support all printers.
the printers. 9. When ever we activate the smart
9. By using OPEN_FORM, form then it generates a function
WRITE_FORM, CLOSE_FORM we module. Through this function module
transfer the data from driver program to only we can transfer the data from
layout. program to layout.
10. Coding is not possible in the 10. Coding is possible in
SAPSCRIPT layout. SMARTFORM layout.
11. By using RSTXDBUG we DEBUG 11. By using STATIC BREAK POINTS
the SAP-SCRIPT. we can debug the SMARTFORMS.
12. In SAP-SCRIPT downloaded file 12. In SAP-SMARTFORMS
is .txt format. downloaded file is .xml format.
7. Labels are not possible here.
Steps To Create Te Smart Form:
1. Execute SMARTFORMS transaction.
2. Provide smart form name, Click on create, Provide short description.
3. In the left panel double click on form interface, under the import tab, Declare your requirement.
P_BUKRS LIKE T001-BUKRS
4. In the left panel double click on global definitions, in the right panel click on types tab.(declare what
ever you want to print)
TYPES: BEGIN OF TY_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
LAND1 LIKE T001-LAND1,
END OF TY_T001.
5. Click on global data tab (provide variables, type assignment and associated type)
Variable name Type assignment Associated type
WA_T001 TYPE TY_T001
6. Under initialization tab provide logic, input/output parameters.
Input parameters Output parameters
P_BUKRS WA_T001
Logic:
SELECT SINGLE BUKRS BUTXT ORT01 LAND1 FROM T001 INTO WA_T001 WHERE
BUKRS = P_BUKRS.
7. Under pages and windows in the left panel
Select the main window right click -> create -> text.
(Text window is provided under main window)
8. Double click on the text.
In the general attributes tab click on Editor, provide the data.
* &WA_T001-BUKRS&
* &WA_T001-BUTXT&
* &WA_T001-ORT01&
* &WA_T001-LAND1&
COME BACK, SAVE, CHECK, ACTIVATE THE FORM.
9. In the menu bar click on environment -> Function Module Name. Function module is generated
(/1BCDWB/SF00000188).
Based on this function module develop the program in the ABAP editor, by calling this function
module.
ABAP Editor:
PARAMETER: PR_BUKRS LIKE T001-BUKRS.
CALL FUNCTION ‘/1BCDWB/SF00000188’
EXPORTING
P_BUKRS = PR_BUKRS .
NOTE: ADRC is the database table which provides entire address information.
Steps to Work with Address Window:
1. Execute SMARTFORMS.
2. Provide smartform name, click on create, provide short description
3. In the left panel double click on form interface,
Under import tab,
P-BUKRS LIKE T001-BUKRS
4. Double click on global definitions in the left panel
Under types tab declare TYPES.
TYPES: BEGIN OF TY_T001,
BUKRS LIKE T001-BUKRS,
ADRNR LIKE T001-ADRNR,
END OF TY_T001.
5. Under global data tab provide
WA-T001 TYPE TY_T001
6. Under initialization tab, implement logic, provide input and output parameters
Input parameters Output parameters
P_BUKRS WA_T001
Logic:
SELECT SINGLE BUKRS ADRNR FROM T001 INTO WA_T001 WHERE BUKRS = P_BUKRS.
7. Select the page under pages and windows in the left panel.
Page -> right click -> create -> address.
8. Double click on address provide address number.
Address number &WA_T001-ADRNR&
SAVE, CHECK And ACTIVATE.
9. In the menu bar click on environment -> Function Module Name. Function module is generated
(/1BCDWB/SF00000189).
Based on this function module develop the program in the ABAP editor, by calling this
function module.
ABAP Editor:
PARAMETER : PR_BUKRS LIKE T001-BUKRS.
CALL FUNCTION ‘/1BCDWB/SF000001189’
EXPORTING
P_BUKRS = PR_BUKRS .
Working with Logo:
We can work with .tiff or .BMP image only.
NOTE:
1. When ever we are working with .tiff image then convert .tiff image into TEXT image.
2. RSTXPDFT4 is the standard program which converts tiff to TEXT image.
3. When ever we are working with .BMP image then convert .BMP image into GRAPHICS image.
4. SE78 is the Transaction code to convert .BMP image to GRAPHICS image.
Steps to convert .BMP to GRAPHICS:
1. Execute SE78, Expand graphics in the left panel, Double click on BMAP.
2. Provide your graphics name, select the radio cotton color, and click on import (F5) in the application
tool bar.
3. Provide your image path, ENTER.
Steps to Provide Ms-Word As Text Editor In Smartform Or Sapscript:
1. Execute I18N t-code.
2. Expand I18N customizing. Double click on MS-WORD as editor.
3. select the checkboxes
SAPSCRIPT SMARTFORMS
4. Click on activate.
(This is possible only after configuring the system).
Steps to Maintain The Backup (Or) Download The Smartform Layout:
1. Execute SMARTFORMS t-code
2. Provide your smart form name which you want to download.
3. In the menu bar click on utilities -> download form, ENTER
4. Provide file name, SAVE.
Steps to Reload The Smartforms (Or) Upload The Smartforms:
1. Execute SMARTFORMS t-code
2. Provide your smart form name and click on delete, yes.
3. In the menu bar click on utilities -> upload form, Provide your form name, ENTER.
4. Browse the file, click on LOCAL OBJECT.
NOTE:
Whenever the smart form is transported from development server to quality server and production
server the function module name never transport.

NOTE:
SSF_FUNCTION_MODULE_NAME is the function module which is used to generate the function
module based on the smart form.
Input for this function module is Smart form name.
Output for this function module is function module name.
NOTE:
If you want to declare the select-options in the SMART-FORMS then we must create a structure with
four fields.
1. SIGN (c,1)
2. OPTION (c,2)
3. LOW Depends on
4. HIGH input fields.
After creating the structure we refer it to the smartform.
Steps to Create The Structure:
1. Execute SE11.
2. Select the radio button data type, Provide your structure name, click on create.
3. Select the radio button structure, Provide short description.
4. Click on predefined type (built-in-type), Provide the components.
Component data type length short description
SIGN CHAR 1 SIGN
OPTIONS CHAR 2 OPTIONS
LOW CHAR 4 LOW
HIGH CHAR 4 HIGH
The length varies with the type like for P.O. Length is (C, 10).
SAVE, CHECK, ACTIVATE structure.

OBJECT: Based on the company code displaying the customers under company
Steps To Create Smartform:
1. Execute SMARTFORMS t-code
2. Provide your SMARTFORM name, click on create, Provide short description.
3. In the left panel click on form interface, under tables tab, Declare the select option
S_BUKRS LIKE <STRUCTURE NAME>
4. Double click on global definitions in left panel, under types tab declare TYPES.
TYPES: BEGIN OF TY_FINAL,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
KUNNR LIKE KNB1-KUNNR,
END OF TY_FINAL.
5. Click on global definitions, under global data tab, declare the WA and IT.
WA_FINAL TYPE TY_FINAL
IT_FINAL TYPE TABLE OF TY_FINAL
6. Click on INITIALISATION tab, Provide input and output parameters and implement the logic.
Input output
S_BUKRS IT_FINAL
Logic:
SELECT T001~BUKRS T001~BUTXT KNB1~KUNNR INTO TABLE IT_FINAL FROM T001 INNER
JOIN KNB1 ON T001~BUKRS = KNB1~BUKRS WHERE T001~BUKRS IN S_BUKRS.
7. Select the main window in the left panel, Right click -> create -> low logic -> loop.
Double click on loop icon, in data tab provide
IT_FINAL INTO WA_FINAL
8. Select the loop in the left panel -> right click -> create -> text.
Text icon is created under main window.
Double click on text icon, click on text editor -> Provide the data.
&WA_FINAL-BUKRS& &WA_FINAL-BUTXT& &WA_FINAL-KUNNR&
SAVE, CHECK, ACTIVATE the form.
9. In the menu bar click on environment -> function module name.
10. Based on the function module develop the print program in ABAP editor
ABAP Editor:
DATA : FN_MODULE TYPE RS38L_FNAM.
DATA V1 LIKE T001-BUKRS.
SELECT-OPTIONS SO_BUKRS FOR V1.
CALL FUNCTION ‘SSF_FUNCTION_MODULE_NAME’
EXPORTING
FORM NAME = <FORM NAME>
IMPORTING
FM_NAME = FN_MODULE .
CALL FUNCTION FM_MODULE
TABLES
S_BUKRS = SO_BUKRS .
(Here RS38L_FNAM is structure name of the function module SSF_FUNCTION_MODULE_NAME, this is
obtained by providing the function module name in SE37 t-code. under export tab, you can get the structure
name. you have to provide this because you are creating structure for select-options.]
Steps To Convert Sapscript Layout To Smart Form:
METHOD-1:
1. Execute SMARTFORMS t-code, Provide your smart form name.
2. In the menu bar click on utilities -> migration -> import sap script form.
3. Provide your script form name, ENTER.
4. SAVE, CHECK, ACTIVATE the form.

METHOD-2:
FB_MIGRATE_FORM is the function module which is used to convert script layout to smart form.
Here provide the function module name in SE37 and click on display and execute and provide your script
and target smart form name and execute and save. The script will converted into smart form.
Steps to convert SAP-SCRIPT OUTPUT to PDF format:
This is the two step procedure.
1. Create SPOOL Request
2. Convert SPOOL to PDF
NOTE: RSTXPDFT4 is the standard report which is used to convert SPOOL TO PDF.
Steps to create SPOOL:
Execute Driver Program, provide input, click on execute, provide output device LP01, select the
Check box NEW SPOOL REQUEST, click on print.
Steps to identify the SPOOL:
Execute SP02, identify the SPOOL number. Or In Menu bar Click on SYSTEM -> OWN
SPOOL REQUEST.
Steps to convert SPOOL to PDF:
Execute SE38, Provide program RSTXPDFT4, Execute, provide your path and click on transfer.
Working With Smart Styles:
1. Smart styles are used to design the paragraph and character formats.
2. The T-code is SMARTSTYLES.
Steps To Create Paragraph & Character Format:
Paragraph Format:
1. Execute smart style T-code.
2. Provide your style name, click on create, Provide short description.
3. In the left panel select the paragraph formats. right click -> create node, Provide paragraph
format name <P1>, ENTER.
4. Provide short description, under font tab provide
Font family ELVE
Font size 6.0 pt
Font style OLD
COLOR
5. Under tabs tab, Provide tab positions
Repeat the same for all the paragraph formats.
Character Formats:
6. In the left panel select character formats right click -> create node, provide your character
format name <C1>.
7. Provide short description, Under font tab provide
Font family ELVE
Font size 6.0 pt
Font style OLD
COLOR
Repeat the same for all the character formats
8. In the left panel double click on the header data
Standard settings
Standard paragraph P1
SAVE, CHECK, ACTIVATE the SMARTSTYLES.
OBJECT: Based on the purchasing
document number display the vendor address
and purchasing document details.
Steps to Design:
1. Execute SMARTFORMS.
2. Provide the smart form name, Click on
CREATE, provide short description.
3. In the left panel click on form interface,
Under import tab
P_EBELN LIKE EKKO-EBELN
4. In the left panel click on global definitions,
Under types tab provide types
TYPES : BEGIN OF TY_EKKO,
EBELN LIKE EKKO-EBELN,
LIFNR LIKE EKKO-LIFNR,
END OF TY_EKKO.
TYPES : BEGIN OF TY_LFA1,
LIFNR LIKE LFA1-LIFNR,
ADRNR LIKE LFA1-ADRNR,
END OF TY_LFA1.
TYPES: BEGIN OF TY_EBELN,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF TY_EKPO.
Under on global data tab,
WA_EKKO TYPE TY_EKKO
WA_LFA1 TYPE TY_LFA1
WA_EKPO TYPE TY_EKPO
IT_EKPO TYPE TABLE OF TY_EKPO
W_TOTAL LIKE EKPO-NETPR
Under initialization tab
Input output
P_EBELN WA_EKKO
WA_EKKO WA_LFA1
IT_EKPO
Logic:
SELECT SINGLE EBELN LIFNR FROM EKKO INTO WA_EKKO WHERE EBELN = P_EBELN.
SELECT SINGLE LIFNR ADRNR FROM LFA1 INTO WA_LFA1 WHERE LIFNR= WA_EKKO-
LIFNR.
SELECT EBELN EBELP MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO
WHERE EBELN = P_EBELN.
5. Under main window in the left panel select the page right click -> create -> address.
6. Double click on address, Provide address number.
&WA_LFA1_ADRNR&
7. In the left panel select address Right click -> create -> graphics.
In the left panel double click on the graphics
NAME <SURYA>
OBJECT GRAPHICS
ID BMAP
Select the radio button bitmap image
8. Select the main window in the left panel, right click -> create -> table.
Under the tables tab, select the line right click -> rename the line -> provide new name, ENTER.
In the left panel select double click on pages and windows, in the left most corner you will find
details, double click and provide cell widths as required.
Click on the data tab.
LOOP:
Internal table IT_EKPO INTO WA_EKPO
9. Select the header in the table left panel Right click -> create -> table line. Select the line type as
LINE1 which name you have given in the 8th step.
In the left panel you can see cells under header
Click on 1st cell -> right click -> create -> text.
Double click on the text Click on general attributes tab, Click on text editor. P1 PUR.DOC
Provide your first column cell name (Repeat the same for all the cells).
10. elect the Main area in the left panel, Right click -> create -> table line (this is for providing data in the
columns in the main area 6 more cells will be provide under main area)
11. Select the first cell right click -> create -> text.
Double click on text, click on text editor, Provide data.
P2 &WA_EKPO-EBELN&
Repeat the same step 12 for all the cells.
In the left panel select the net price. Right click -> create -> flow logic -> program lines.
Double click on the code in the left panel.
Input output
EKPO-NETPR W_TOTAL
W_TOTAL = W_TOTAL + WA_EKPO-NETPR
Under main window in the left panel, select the table in the left panel select the first line, Right
click -> insert -> empty line underneath (creates empty space for footer)
12. Select the new line right click -> rename line -> provide new name, ENTER.
13. Click on table Select the pattern, by clicking on the top most right corner.
Click on display framed patterns Select your pattern.
14. Select the footer in the left panel right click -> create -> table line. Select the line.
Select the cell -> create -> text.
Click on text editor provide data with its paragraph.
P3 TOTAL,, &W-TOTAL(C) & Here C refers to COMPRESS i.e. no space is provide.
15. SAVE ,CHECK ACTIVATE the form
16. In the menu bar -> click on environment -> function module.
17. Based on the function module develop the print program in ABAP editor.
ABAP Editor:
DATA FN_MODULE TYPE RS38L_FNAM.
PARAMETER PR_EBELN LIKE EKKO-EBELN.
CALL FUNCTION ‘SSF_FUNCTION_MODULE_NAME’
EXPORTING
FORM NAME = <FORM NAME>
IMPORTING
FM_NAME = FN_MODULE .
CALL FUNCTION FM_MODULE
TABLES
P_EBELN = PR_EBELN .
Events in Internal Table or Control Break Statements:
1. AT FIRST
2. AT LAST
3. AT NEW <field name>
4. AT END OF <field name>
These events are work with in the LOOP…ENDLOOP of the internal table. Each event ends with ENDAT.
NOTE: Before using these events we must sort the internal table based on the new field.
AT FIRST: This is the event which is triggered at the
first record of the internal table
Advantage: This is used to print the heading.
AT LAST: This is the event which is triggered at the
last record of the internal table.
Advantage: This is used to print the grand totals.
AT NEW: This is the event which is triggered at the
new record of each block.
Advantage: This is used to print the individual heading
of each record.
AT END OF: This is the event which is triggered at the
last record of each block.
Advantage: This is used to print the subtotals.
REQUIREMENT:
Logic:
LOOP AT IT_EKPO INTO WA_EKPO.
AT FIRST.
WRITE /’PURCHASING DOCUMENTS’.
ENDAT
AT NEW EBELN.
WRITE /WA_EKPO-EBELN.
ENDAT
WRITE : / WA_EKPO-EBELP,WA_EKPO-
MENGE,WA_EKPO-MEINS, WA_EKPO-NETPR.
S_TOTAL = S_TOTAL + WA_EKPO-NETPR.
G_TOTAL = G_TOTAL + WA_EKPO-NETPR.
AT END OF EBELN.
WRITE: /’SUBTOTAL’, S_TOTAL.
CLEAR W_STOTAL.
ENDAT.
ATLAST
WRITE : / ‘GRANDTOTAL IS’ G_TOTAL.
ENDAT.
ENDLOOP.

Das könnte Ihnen auch gefallen