06-18-2008 1:20 PM
hey can anyone post me how to do smartforms in ecc 6.0 along with print program plzzzzzzzzz urgent.
06-18-2008 1:23 PM
06-18-2008 1:34 PM
John,
I feel duty bound to point out your spelling error. Surely everyone knows plzzzzzzz has only one L.
Regards,
Nick
06-18-2008 2:43 PM
06-18-2008 2:47 PM
Right...., but there already so many point naggers around this forum these days. I get my satisfaction out of other things....
06-18-2008 1:30 PM
Hi,
chk these links.
http://help.sap.com/saphelp_nw04s/helpdata/en/a5/de6838abce021ae10000009b38f842/content.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci1001864,00.html
http://www.sap-press.com/downloads/h955_preview.pdf
Regards
Sandeep Reddy
06-18-2008 1:37 PM
below are the example programs names and smart form names (both names are same).
sf_example_01
sf_example_02
sf_example_03
06-18-2008 1:38 PM
Hi,
Go to the following link which explains step by step with screen shots on creating a smartform.you can easily understand and create the form on your own.
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc 0.
WRITE: / 'ERROR 1'.
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
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards,
Raj.
06-18-2008 2:20 PM
hi
go to this link
http://saptechnical.com/Tutorials/Smartforms/SFMain.htm
http://sap-img.com/smartforms/sap-smart-forms.htm
PLZ REWARD POINTS
Cheers
Snehi
06-18-2008 2:25 PM
08-27-2008 1:25 PM
SAP Smart Forms allow us to execute simple modifications to the form and in the form logic by using simple
graphical tools; in 90% of all cases, this won't include any programming effort. To print a form, you need a
program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form
logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. For the
purpose of demonstrating the power and download capabilities of Smart form, I have created a Smart from
named ZSMARTFORM_SWAR.
Creation of SMART FORM:
From SAP R/3 release 4.6C onwards, SAP has come up with the concept of SMART FORMS. Prior to SAP
R/3 4.6C, Sap Scripts were being used for mass printing. To create a smart form, execute the transaction
u201CSMART FORMSu201D. Provide u201CZSMARTFORM_SWARu201D as the name of the Smart form. Select u201CCreateu201D.
When you create a Smart Form, the tree structure of the Form Painter already contains two root nodes:
u2022 Global setting
u2022 Pages and Windows
Global Setting
The node Global Settings as well as its three successors Form attributes, Form interface, and Global
definitions always exist for any newly created forms.
Form attributes
Here you need to provide the description for the smart form. In this case, the description is u201CCreate and
Download SMART FORM to PDFu201D. Here, there is a provision to specify whether the Smart form can be
translated to other languages in future.
Form Interface
In Form Interface, you can specify the parameters that would be imported and exported to Smart form. In this
case, I have imported two parameters u201CMYDATEu201D and u201CREASONu201D. In this case, there are no Export
parameters and Tables. These can be used if we intent to pass information from Smart forms to the ABAP
program. There are few standard import and export parameters that can be used depending on the
functionality.
Pages and windows:
A form can consist of pages, output areas, addresses, graphics (such as company logo), and data or text
contents. Within an output area, we can use static or dynamic tables to display data or texts in lines, columns,
or cells. To further structure and format text and data, we can use paragraphs with the paragraph and
character formats. SAP calls output areas "windows". We can position windows freely on a page. On a page,
there are two different types of output areas for texts and data: the main window and the sub window.
Graphics:
In the Form Builder we 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. On the user Interface, specify the name, object and Id of the bitmap image
to be placed on the Smart form.
Main window
On a page, there are two different types of output areas for texts and data: the main window and the sub
window. In a main window you display text and data, which can cover several pages (flow text). As soon as a
main window is completely filled with text and data, the system continues displaying the text in the main
window of the next page. It automatically triggers the page break.
Downloading Smart Form to PDF from Application
You can pass data retrieved from the application to the Smart form using the Form Interface. The data could
also include the data retrieved from database tables. In addition, you can define exceptions to which the
application program must react. You trigger form printing by calling only two function modules. The first
module uses the name of the form to determine the name of the generated function module. Then you call
this Smart form.
Call function module SSF_FUNCTION_MODULE_NAME. It returns the name of the generated function
module. Call the generated function module. To do this, use the Insert statement function for CALL
FUNCTION in the ABAP Editor. Then replace the function module name with the variable FM_NAME. Set the
u2018GETOTFu2019 parameter to u2018Xu2019 and pass it to CONTROL_PARAMETERS. The function module would export the
Smart form to an internal table u2018T_OTFDATAu2019.
Call the function module u2018CONVERT_OTFu2019 to convert the smart form to PDF format. The function module
returns the size of downloaded file. Using u2018WS_DOWNLOADu2019 function module, you can download the Smart
form to a PDF file in the required directory.
REPORT zswar.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER: p_date LIKE sy-datum.
PARAMETER: p_rea TYPE char255.
SELECTION-SCREEN: END OF BLOCK b1.
DATA: ws_ucomm LIKE sy-ucomm.
INITIALIZATION.
SET PF-STATUS 'STANDARD' OF PROGRAM 'ZSWAR'.
AT SELECTION-SCREEN.
ws_ucomm = sy-ucomm.
CASE ws_ucomm.
WHEN '&PDF'.
PERFORM f1000_download_form.
EXIT.
WHEN '&BACK'.
SET SCREEN 0.
EXIT.
WHEN '&EXIT'.
SET SCREEN 0.
EXIT.
WHEN '&canc'.
SET SCREEN 0.
LEAVE TO SCREEN 0.
ENDCASE.
&----
*& Form F1000_DOWNLOAD_FORM
&----
text
----
--> p1 text
<-- p2 text
----
FORM f1000_download_form.
DATA: form_name TYPE rs38l_fnam.
DATA: wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop.
DATA: t_otfdata TYPE ssfcrescl,
t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE i.
DATA: w_bin_filesize TYPE i.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORM_SWAR'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = form_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.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = wa_ctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = wa_outopt
user_settings = 'X'
mydate = p_date
reason = p_rea
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = t_otfdata
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4
.
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 'WS_DOWNLOAD'
EXPORTING
bin_filesize = w_bin_filesize
CODEPAGE = ' '
filename = 'd:\test.PDF'
filetype = 'BIN'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
filelength = w_filesize
TABLES
data_tab = t_pdf_tab
FIELDNAMES =
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
ELSE.
MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
'under D drive'.
ENDIF.
ENDFORM. " F1000_DOWNLOAD_FORM