SMARTFORM PDF PRINT PREVIEW - URGENT!!
Hi All,
I have a requirement to get a print preview of the smartform in the pdf format and have the option to either print it or save it.
meaning - the adobe application must automatically open and in it, there must be a window to display the smartform in the PDF format.
the code i have so far is as below
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = W_FORM_NAME
IMPORTING
FM_NAME = W_FMODULE
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.
Calling the SMARTFORM using the function module retrieved above
GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
gst_output_options-tddest = 'FRNT_End_Print'. "Frontend printer
gst_output_options-tdnewid = sy-prnew.
gst_output_options-tdimmed = 'X'.
gst_output_options-tddelete = sy-prrel.
clear gst_control_parameters.
gst_control_parameters-no_dialog = 'X'.
gst_control_parameters-getotf = 'X'.
gst_control_parameters-preview = 'X'. "Deactivate preview!
*Call the original function module.
call function w_fmodule
exporting
control_parameters = gst_control_parameters
output_options = gst_output_options
importing
job_output_info = gt_job_output_info
job_output_options = gt_output_options
tables
tbl_amt = final_tab
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
T_OTF] = gt_job_output_info-OTFDATA[.
call function 'SSFCOMP_PDF_PREVIEW'
exporting
i_otf = t_otf
exceptions
convert_otf_to_pdf_error = 1
cntl_error = 2
others = 3.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
The adobe application is launched but the window inside does not hold anything.
i get a pop-up inside the adobe window with the message " FILE DOES NOT BEGIN WITH '%PDF-' ".
Any suggestions are greatly appreciated.
hoping to hear from you all.
thank you.
Sandeep
Hi,
Check the foll code it does the same thing.........
Give a simple form(without any parameters) to check the code..........
DATA: v_form_name TYPE rs38l_fnam,
wa_control_parameters TYPE ssfctrlop,
it_job_output_info TYPE ssfcrescl,
v_bin_filesize TYPE i,
it_otf_data TYPE tsfotf,
it_doctab_archive TYPE TABLE OF docs WITH HEADER LINE,
it_lines TYPE TABLE OF tline WITH HEADER LINE.
PARAMETER p_sform TYPE tdsfname OBLIGATORY DEFAULT 'Put ur form name here'.
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_sform
IMPORTING
fm_name = v_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc = 0.
wa_control_parameters-no_dialog = 'X'.
wa_control_parameters-getotf = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = wa_control_parameters
IMPORTING
job_output_info = it_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc = 0.
it_otf_data = it_job_output_info-otfdata[].
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = it_otf_data[]
EXCEPTIONS
convert_otf_to_pdf_error = 1
cntl_error = 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.
ENDIF.
ENDIF.
Cheers,
jose.
Similar Messages
-
PDF print preview not coming as it contains chinese character
hi
when i see the print preview of the Delivery note ( in scripts ) normally, the chinese characters appears. but when i want to check with pdf print preview nothing is coming.
i am using convert_otf func. module.
is it because of function module or because of adobe acrobat?
also when i try to print the ordinary print preview - output is coming as ####.
My advance thanks for your replies.
Regards,
Sakthi Sri.Hi Sandra Rossi,
In PDF i could not able to get the output. So discussed with TL and we made the chinese characters in .tiff and uploaded through se78 and now it is coming in ordinary print preview.
but this is only temporary solution.
Anyhow thanks for help given by experts. -
Firefox10 was unable to invoke adober pdf print preview where as Firefox 3 was able to do this.
embed pdf document or use iframe
Firefox successfully loads the PDF into the iFrame.
What doesn't happen is printing.
http://forums.adobe.com/thread/909776Also check this out. Firefox10 was able to display the pdf document perfectly.
Now goto Firefox options and click print which invokes the printer print view and NOT the Adobe print view.
Also if you click the print preview a blank page is shown.
<embed id="pdf" src="archive.pdf" type="application/pdf" height="100%" width="100%" ></embed> -
Simple way to create a pdf print preview in icwc
Hello gurus,
I have this customer task, to create a print preview for icwc. I checked note 1323062, but I´m working with version 5.0, so it can´t be used. I checked also note 896953, but this more to a error related. Checked also 616762, but the note is high level in details. Does not explain how to redirect the output of the processing to the icwc (step 5).
So in this way, I´d like to be advised from you folks, how to do it.
I was thinking in to use and adapt Craig's blog for this. http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1002. [original link is broken]
Is somebody else used another solution or some tip to give, please, will be very welcome.
cheers,
DavidHi Luiz,
It will be great if you can forward the paper created on pdf print preview to my profile id.
Thanks in Advance
Anil... -
Questions about "PDF print previewer" in PO
Dear all,
I am looking for "PDF print previewer" to improve the 'visual identity' of PO in preview. Can I ask how to activate the "PDF print previewer" in PO function or any configuration is needed?
Is it after apply "PDF print previewer" in SAP, a pdf viewer will be emabdded in the PO preview function?
Many thanks for your help
Sunnyhi sunny,
For control print preview of purchase order you have to contact ABAP , they will select according to your requirement
Regards -
Firefox10 was unable to invoke adober pdf print preview where as Firefox 3 was able to do this.
embed pdf document or use iframe
Firefox successfully loads the PDF into the iFrame.
What doesn't happen is printing.
http://forums.adobe.com/thread/909776Also check this out. Firefox10 was able to display the pdf document perfectly.
Now goto Firefox options and click print which invokes the printer print view and NOT the Adobe print view.
Also if you click the print preview a blank page is shown.
<embed id="pdf" src="archive.pdf" type="application/pdf" height="100%" width="100%" ></embed> -
Converting Smartforms to PDF and displaying Smartforms on print preview
Hi,
How to convert smartforms to pdf?
How to attach this pdf to email?
How to attach this pdf to the email and at the same time can print preview the smartforms?
Thanks.Hi Navi,
Code Snippet for Simple Mail
*& Report ZZ_TEST *
REPORT zz_test .
INCLUDE zz_test_top.
INCLUDE zz_test01.
FORM entry *
--> RETURN_CODE *
--> US_SCREEN *
FORM entry USING return_code us_screen.
CLEAR retcode.
xscreen = us_screen.
PERFORM processing USING us_screen.
CASE retcode.
WHEN 0.
return_code = 0.
WHEN 3.
return_code = 3.
WHEN OTHERS.
return_code = 1.
ENDCASE.
ENDFORM. "entry
*& Include ZZ_TEST_TOP *
TABLES : nast,
tnapr.
TYPES : BEGIN OF t_SOUDNAMEI1.
INCLUDE STRUCTURE SOUDNAMEI1.
TYPES : END OF t_SOUDNAMEI1.
Internal Table declarations
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
*Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
i_lips LIKE lips OCCURS 0 WITH HEADER LINE,
i_SOUDNAMEI1 TYPE STANDARD TABLE OF t_SOUDNAMEI1.
Work Area declarations
DATA:w_objhead TYPE soli_tab,
wa_control_parameters TYPE ssfctrlop,
wa_output_options TYPE ssfcompop,
w_return TYPE ssfcrescl,
w_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
w_buffer TYPE string,"To convert from 132 to 255
wa_SOUDNAMEI1 TYPE t_SOUDNAMEI1,
Variables declarations
w_form_name TYPE rs38l_fnam,
w_len_in LIKE sood-objlen,
w_len_out LIKE sood-objlen,
w_len_outn TYPE i,
w_lines_txt TYPE i,
w_lines_bin TYPE i,
retcode TYPE sy-subrc,
xscreen TYPE c,
w_spld TYPE usr01-spld,
w_receiver TYPE SOXNA-FULLNAME,
w_OBJ_RECORD TYPE OBJ_RECORD,
w_user type sy-uname,
w_email TYPE ad_smtpadr.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X',
c_atrate(1) TYPE c VALUE '@'.
*& Include ZZ_TEST01 *
FORM PROCESSING *
FORM processing USING proc_screen.
SELECT * FROM lips
INTO TABLE i_lips
WHERE vbeln = nast-objky.
Call Function module to Getfunction Module name Generated by Smartform
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = tnapr-sform
IMPORTING
fm_name = w_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
retcode = sy-subrc.
ENDIF.
CLEAR : wa_control_parameters,
wa_output_options.
CASE nast-nacha.
WHEN '1'.
wa_control_parameters-device = 'PRINTER'.
WHEN '7'.
DATA: l_email TYPE ad_smtpadr.
wa_output_options-tdnoprev = c_x.
wa_control_parameters-getotf = c_x.
To get the default output device maintained in the
User profile
SELECT SINGLE spld FROM usr01
INTO w_spld
WHERE bname EQ nast-usnam.
IF sy-subrc EQ 0.
MOVE w_spld TO wa_output_options-tddest .
ENDIF.
wa_output_options-tdnoprev = c_x.
wa_control_parameters-getotf = c_x.
To get the email address maintained for the particular output
CALL FUNCTION 'NAST_GET_MESSAGE_OBJECT_RECV'
EXPORTING
pi_objkey = nast-tdname
IMPORTING
pe_addr = w_receiver
CHANGING
pc_objhandle = w_obj_record
EXCEPTIONS
maildata_not_readable = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF w_receiver NA c_atrate.
To retrieve the E-Mail Id in case we get the User name from NAST
CLEAR wa_soudnamei1.
REFRESH i_soudnamei1.
MOVE w_receiver TO wa_soudnamei1-fullname.
To get the user name
CALL FUNCTION 'SO_NAME_CONVERT_API1'
EXPORTING
name = wa_soudnamei1
TABLES
names = i_soudnamei1
EXCEPTIONS
user_not_exist = 1
parameter_error = 2
x_error = 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.
CLEAR wa_soudnamei1.
READ TABLE i_soudnamei1 INTO wa_soudnamei1 INDEX 1.
MOVE wa_soudnamei1-sapname TO w_user.
To get the e-mail Id maintained in the user profile
CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
EXPORTING
i_user = w_user
IMPORTING
e_email_address = l_email
EXCEPTIONS
mail_address = 1
determination_error = 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.
MOVE l_email TO w_receiver.
ENDIF.
MOVE w_receiver TO w_email.
ENDCASE.
wa_control_parameters-no_dialog = c_x.
wa_control_parameters-langu = nast-spras .
wa_output_options-tdteleland = nast-tland.
wa_output_options-tdtelenum = nast-telfx .
wa_output_options-tdsenddate = nast-erdat .
wa_output_options-tdsendtime = nast-eruhr .
wa_output_options-tddataset = nast-dsnam .
wa_output_options-tdsuffix1 = nast-dsuf1 .
wa_output_options-tdsuffix2 = nast-dsuf2 .
wa_output_options-tdimmed = nast-dimme .
wa_output_options-tddelete = nast-delet .
wa_output_options-tdautority = nast-tdautority.
wa_output_options-tdcovtitle = nast-tdcovtitle .
wa_output_options-tdcover = nast-tdocover .
wa_output_options-tdreceiver = nast-tdreceiver.
wa_output_options-tddivision = nast-tddivision.
wa_output_options-tdcopies = nast-anzal .
wa_output_options-tdnewid = c_x.
wa_output_options-tdarmod = nast-tdarmod.
wa_output_options-tdnoarmch = c_x.
CALL FUNCTION w_form_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = wa_control_parameters
output_options = wa_output_options
user_settings = ' '
IMPORTING
job_output_info = w_return
TABLES
it_lips = i_lips
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF nast-nacha EQ 7 AND sy-subrc EQ 0.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_len_in
TABLES
otf = i_otf
lines = i_tline
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.
Convert PDF from 132 to 255.
LOOP AT i_tline.
Replacing space by ~
TRANSLATE i_tline USING ' ~'.
CONCATENATE w_buffer i_tline INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~ '.
DO.
i_record = w_buffer.
Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
REFRESH: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR w_objhead.
Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES w_lines_bin.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
CONCATENATE 'Delivery' 'Note'
INTO w_doc_chng-obj_descr.
*w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'. "Functional object
w_doc_chng-doc_size = w_lines_txt * 255.
Pack to main body as RAW.
Obj. to be transported not in binary form
CLEAR i_objpack-transf_bin.
Start line of object header in transport packet
i_objpack-head_start = 1.
Number of lines of an object header in object packet
i_objpack-head_num = 0.
Start line of object contents in an object packet
i_objpack-body_start = 1.
Number of lines of the object contents in an object packet
i_objpack-body_num = w_lines_txt.
Code for document class
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = w_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Delivery' 'Note' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = w_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = w_email.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'. "Internet address
APPEND i_reclist.
sending mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. "processing
OTF to PDF
========================================================================
Program1
*& REPORT zpmm_print1
REPORT zpmm_print1.
DATA : gw_ssfcrescl TYPE ssfcrescl.
DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
gt_tline TYPE STANDARD TABLE OF tline,
gv_len LIKE sood-objlen,
gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
DATA fm_name TYPE rs38l_fnam.
gw_ssfctrlop-getotf = 'X'.
gw_ssfctrlop-no_dialog = 'X'.
gw_ssfcompop-tdnoprev = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPMM_1'
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
<error handling>
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = gw_ssfctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = gw_ssfcompop
user_settings = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = gw_ssfcrescl
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.
gt_otf[] = gw_ssfcrescl-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_len
TABLES
otf = gt_otf
lines = gt_tline
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.
DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = gv_len
filename = gv_filename
filetype = 'BIN'
filetype_no_show = 'X'
IMPORTING
act_filename = gv_filename
filesize = gv_len
cancel = ''
TABLES
data_tab = gt_tline.
Program 2
*& REPORT zpmm_print2
REPORT zpmm_print2.
DATA : gw_ssfcrescl TYPE ssfcrescl.
DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
gt_tline TYPE STANDARD TABLE OF tline,
gv_len LIKE sood-objlen,
gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
DATA fm_name TYPE rs38l_fnam.
gw_ssfctrlop-getotf = 'X'.
gw_ssfctrlop-no_dialog = 'X'.
gw_ssfcompop-tdnoprev = 'X'.
CALL FUNCTION '/1BCDWB/SF00000041'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = gw_ssfctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = gw_ssfcompop
user_settings = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = gw_ssfcrescl
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.
gt_otf[] = gw_ssfcrescl-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_len
TABLES
otf = gt_otf
lines = gt_tline
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.
DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = gv_len
filename = gv_filename
filetype = 'BIN'
filetype_no_show = 'X'
IMPORTING
act_filename = gv_filename
filesize = gv_len
cancel = ''
TABLES
data_tab = gt_tline.
=========================================================================
Cheers
Mohinder Singh Chauhan -
Hi Folks,
Here we have designed a Invoice-smartform and converted it into PDF which is by default storing in c-drive as mentioned in the code.When we open the Pdf it is displaying it fine but when given a printout except the logo nothing is getting printed,I mean it is showing all junk characters.May I know what is the problem and how to rectify the same.
Points will be given.
K.Kiran.Hi Kiran, see the OSS notes: 960341 and 776507.
I downloaded and copying here, Hope this will be helpful
OSSNote:960341
Symptom
In some device types (e.g HPLJ4, HPLJ5) you experience non-uniform character spacing in the PDF document after the PDF conversion of SAPscript or Smart Forms documents, using HELVE or TIMES fonts. You want to know the reason.
Other terms
CONVERT_OTF, SAPscript, Smart Forms
Reason and Prerequisites
The problem is not due to an error in the PDF converter but due to the fact, that the printer font, underlying the device type (e.g. Univers or CG Times in PCL-5 device types), is not available for the PDF converter and is either not available in Adobe Reader. The PDF converter has to try to simulate the layout of the printer font by means of a font which is predefined in Adobe Reader. This is done by assigning the letter widths of the printer font to the font used in Adobe Reader.
The PDF file contains a table with letter widths, used by Adobe Reader in the output of text, for each used printer font (except PostScript fonts).
Example:
%Charwidth values from HP4300 HELVE 060 normal
/Widths
[ 278 333 500 633 633 1000 758 333 333 333 633...
Adobe reader converts this width table, by modifying the space between each character, so that the specified letter width (= space between the current and the next letter) is kept.
This 'Simulation' of printer fonts results in the sometimes visible irregular spaces in PDF.
The PDF converter always uses the Helvetica Adobe PostScript font for the display of HELVE and the Times Roman Adobe PostScript font for the display of TIMES. However, for these Adobe PostScript fonts, Adobe Reader often uses a Windows TrueType font, which differs slightly from the original PostScript font.
Solution
Workaround: Use the POST2 PostScript device type or the PDF1 PDF device type for the PDF conversion of documents in the Latin-1 character set. They both use the Adobe PostScript fonts Helvetica or Times Roman for the HELVE/TIMES printer fonts.
Header Data
Release Status: Released for Customer
Released on: 30.06.2006 12:44:06
Priority: Recommendations/additional info
Category: Consulting
Primary Component: BC-CCM-PRN Print and Output Management
Secondary Components: BC-SRV-SCR SAPscript
OSS Note: 776507
Symptom
Documents printed via SAPscript or SmartForms do not print with correct special characters, e.g. ### prints instead of Japanese or Russian characters. What to do?
Other terms
SAPscript, SmartForms, printing, device types, OTF
Reason and Prerequisites
Help required to choose proper fonts in a SAPscript or SmartForm
Solution
When using SAPscript or SmartForms to print (or email or fax) a form from a business application, many factors influence the outcome of the actual text within the form. All these factors must be checked in order to ensure a correct printout:
1) The language version of the form used to produce the printout.
Example: If you want to print a French invoice, you need to have a FR version of your SAPscript or SmartForms invoice form RVINVOICE01. And the application program must specify the corresponding language key (FR) when calling the SAPscript or SmartForms API.
2) The font selections specified in the form (possibly also in a SAPscript style or SmartStyle used in a form).
Example: In a SAPscript form or a SmartStyle you need to specify HELVE if you want to print German text in Helvetica (or similar) font. If you want to print Japanese text, HELVE is not a valid choice but you need to specify a Japanese font like JPMINCHO in your Japanese form.
3) The output character set of the device type
Every printer in transaction SPAD has a "device type" assigned. Device types used by the spooler for printing support only one single specific output character set. All text from the form has to be converted (using SAP's built-in character conversion mechanism) to this output character set.
A character set can typically support either a single language (e.g. Shift-JIS which supports only Japanese) or a set of languages (e.g. ISO 8859-1, which supports Western-European languages). It is possible that a given language (such as German) can be supported by several output character sets, e.g. you may use either ISO 8895-1 (Latin-1) or ISO 8859-2 (Latin-2) to represent German text. This is so because both character sets contain the special characters used in German.
Example: HPLJ4000 is a HP LaserJet device type supporting the ISO 8859-1 (Latin-1) character set. ISO 8859-1 can be used to represent e.g. Dutch, English, French, German, Spanish, Swedish but NOT Russian or Japanese.
As a consequence, it is ok to use HPLJ4000 to print English, German French etc. but not for Japanese or Russian.
4) The set of available printer fonts for a given device type
When formatting a document, SAPscript and SmartForms perform an automatic mapping of the font definitions in the form (e.g. "HELVE 14 point bold") and the available printer fonts of the device type. A replacement printer font is chosen, should the specified font selection not be available in the device type. Now this replacement can be problematic if a language-specific font, such as Chinese CNSONG, is specified in a form and it gets replaced by a font which does not support this language, e.g. COURIER.
To solve this problem, font families in SE73 have language attribute assigned, e.g. some fonts are characterized as being suitable only for certain languages. And when a replacement has to be chosen because the original font from the form is not available in the device type, a replacement font is chosen which has the same language attributes.
If no fonts for the language in question exist in the device type, the resulting font will not be able to print the special characters and you will see "wrong" output characters in the printout.
Note on SAPscript/SmartForms Print Preview:
The OTF Print Preview available in Windows GUI (e.g. from transaction SP01) will sometimes not show the "wrong" characters which appear on the final printout. Here is the reason: since the Print Preview runs in Windows environment, it will use Windows fonts to represent the actual printer fonts. A Windows font typically has more available characters (i.e. covers more character sets) than are actually available in a printer's resident font.
A typical example where the Print Preview will differ from the printout is here: if you have a Chinese PCL5 printer such as CNHPLJ4 and use the Western Latin font COURIER in your document, the print preview will show you Chinese characters if you (by accident) tried to format Chinese characters in COURIER font. This is because Windows will automatically choose a font that can output Chinese characters (which is actually not Courier). But when you print the job on an actual PCL5 printer with resident Western and Chinese fonts, the Courier font will not print any Chinese characters but Western special characters instead, because the printer's resident Courier font does not include Chinese characters.
Rule of thumb: all Asian device types (e.g. CNHPLJ4, JPHPLJ4, JPPOST, KPHPLJ4) support not only Asian fonts but also COURIER, HELVE and TIMES fonts. But these Latin fonts can only be used to print English text, not Chinese/Japanese/Korean characters.
Which fonts are suitable for a given language?
Language(s): Font family to use in a form:
Latin-1 (Western Europe/Americas) *******
DE,EN,FR,ES,NL,SV COURIER, HELVE, TIMES
(LETGOTH, LNPRINT)
Latin-2 (Central Europe) ****************
PL, CZ COURIER, HELVE, TIMES
ISO 8859-4 (Baltic) *********************
ET, LT, LV COURIER, HELVE, TIMES
ISO 8859-5 (Cyrillic) *******************
BG, RU, SR, UK COURCYR, HELVCYR, TIMECYR
ISO 8859-7 (Greek) **********************
EL COUR_I7, HELV_I7, TIME_I7
ISO 8859-8 (Hebrew) *********************
HE COURIER, HELVE, TIMES
ISO 8859-9 (Turkish) ********************
TR COURIER, HELVE, TIMES
Simplified Chinese **********************
ZH CNHEI, CNKAI, CNSONG
Japanese ********************************
JA JPMINCHO, DBMINCHO, DBGOTHIC
Korean **********************************
KP KPBATANG, KPDODUM, KPGULIM
KPGUNGSE, KPSAMMUL
Traditional Chinese *********************
ZF TWDPHEI, TWMING, TWSONG
Thai ************************************
TH THANGSAN, THDRAFT, THVIJIT
Arabic (Unicode systems only) ***********
AR ANDALE_J
Verify your output by examining the OTF data
When analysing printing problems of this type, be sure to check the OTF data which gets produced by SAPscript or SmartForms. OTF or "Output Text Format" is the intermediate page-description format generated from SAPscript or SmartForms. OTF will contain the final printer font names and character set/language identifiers which help to solve the problem. OTF will even name the form and the language of the form used to create the output.
The easiest way to do this is to create a spool request from your application, run transaction SP01, use menu
Goto->Display Requests->Settings
and choose
Display Mode: Raw
Now display your spool request. If this is a SAPscript or SmartForms spool request, you will see OTF data. Each line represents one OTF command, every command starts with a 2-character cmd identifier and possibly some cmd parameters follow.
Here is an excerpt from a sample OTF file where we highlight the most interesting commands:
//XHPLJ8000 0700 00000000001
IN04EALEXTEST_ZEBRA
IN05%PAGE1
OPDINA4 P 144 240 1683811906000010000100001
IN06%WINDOW2
MT0024401289
CP11000000E
FCHELVE 120 00109XSF100SF101110000067E X
UL +0000000000000
SW00067
CT00000000
ST0453037Dieses SF hat Stil ALEXTEST_ZEBRA mit
The 1st line with the // (Control) command reveals the device type usedto print: HPLJ8000
//XHPLJ8000 0700 00000000001
The 2nd line (IN = Info command) shows the name and (internal 1-char)language key of the form:
IN04EALEXTEST_ZEBRA
In this case it is the English (E = EN) SmartForm ALEXTEST_ZEBRA
The OP-line (OP = Open Page) gives the page format used in the form, it is DINA4 Portrait orientation:
OPDINA4 P 144 240 1683811906000010000100001
The CP (CodePage) cmd shows the SAP system codepage used to code the text and the active language. In our case it is codepage 1100 and language E = EN = English.
CP11000000E
Finally, the FC-cmd (Font Call) lists a printer font selected within SmartForms. Please note that every SmartForm has a designated default SmartStyle under "Form Attributes->Output Options". In addition, every text node can have a SmartStyle attached (which will override the definitions from the default style for the text). In our case the resulting printer font that was selected is HELVE 12.0 pt bold-off, italic-off.
FCHELVE 120 00109XSF100SF101110000067E X
Header Data
Release Status: Released for Customer
Released on: 22.08.2005 09:57:20
Priority: Recommendations/additional info
Category: Customizing
Primary Component: BC-CCM-PRN Print and Output Management
Secondary Components: BC-SRV-SCR SAPscript
BC-SRV-SSF Smart Forms
regards,
Anji -
Hi experts,
I have a requirement where I display the output of a program in popup in PDF format when user clicks on a button.
I am able to do that and output is shown properly in PDF format.
But now the problem is he wants PDF to be shown directly in 'Print Preview' mode.
Can you please suggest me how it can be done.
I am using 'get_Print_parameters' Function Module.
Is there any parameter which we need to set for this purpose.
Thanks in advance.
Regards
VasuHi,
You can use following code --
DATA: LV_CONTROL_PARAMETERS TYPE SSFCTRLOP.
* Set relevant control parameters
LV_CONTROL_PARAMETERS-DEVICE = 'PRINTER'. "Printer Device
LV_CONTROL_PARAMETERS-GETOTF = L_X. "OTF output
LV_CONTROL_PARAMETERS-NO_DIALOG = ' '. "L_X. No print dialog
LV_CONTROL_PARAMETERS-PREVIEW = 'X'. " This would enable Preview SPACE is for No preview
* Set relevant output options LV_OUTPUT_OPTIONS-TDNEWID = L_X. "Print parameters,
LV_OUTPUT_OPTIONS-TDDELETE = ' '. "SPACE. Print parameters,
Check this, this worked in my case.
Thanks.
Kumar Saurav. -
Value pass to Smartform when Print/Preview
Hi,
I've a custom print program and smartform. All my selecting data codes are in Smartform. How do I let Smartform knows whether I'm doing a preview or print? What values should I pass into Smartform?
I'd like to achieve something as follows:-
IF print preview.
DO a.
ELSE.
DO b.
ENDIF.
Please share your thoughts.Hi Brad,
Actually it is not the data selected that determines the print preview. Let me give a clearer scenario.
When user clicks Print Preview, user able to see a preview of the form. However, when user clicks Print, form is printed and some data is saved to a custom table.
Currently, both print preview and print will save the data to the custom table. So I'd like to know how to prevent data being saved into the custom table when user performs a print preview.
Thanks. -
Problem with Print Preview Urgent!
Hello BW Experts,
1.I am trying to use the Print functionality for web printing.In the print preveiew i see all the text in black and white.It is completely different from the page that is displayed in the browser.
--I tried using the same print stylesheet but it does not work.
2.In the print preview how do i change the default header line height to some other value.
3.If i select file>print preview in internet explorer it is treating the logo as a different page,so the logo is printing in seperate page followed by the text.
I appreciate all your help.
Thank you all!
RajThanks deepak for the reply.
I am using the stylesheet and media = print but i still have the problem.
This is the javascript function i am using
<head>
<link href="/sap/bw/Mime/BCT/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet"/>
<script>
<script language=javascript>
function callPrintHelpService(parameter, cell_type, filter, parameter1, parameter2, item, dataprovider, x, y) {
var print_service = "Z_PRINT_HELP_SERVICE"
<!--if ( parameter == "inches") print_service = "Z_PRINT_HELP_SERVICE_IMP";
var cmd = url + "&DATA_PROVIDER=DP&HELP_SERVICE_CLASS=" + print_service;--->
SAP_BW_URL_Get();
if( dataprovider == "DP") window.open(url, "Print", "width=800, height=600, menubar=yes, toolbar=no, scrollbars=yes, resizable=yes"); }
</script>
<!-- Query description in the window title bar --->
<title>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="TITLE"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
<param name="DATA_PROVIDER" value="DP"/>
<param name="GENERATE_CAPTION" value=""/>
<param name="ELEMENT_TYPE_1" value="COMMON"/>
<param name="ELEMENT_NAME_1" value="REPTXTLG"/>
<param name="ONLY_VALUES" value="X"/>
<param name="ELEMENT_NAME" value="REPTXTLG"/>
ITEM: TITLE
</object>
</title>
<link href="/sap/bw/Mime/BEx/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet" media="print"/>
</head>
1.---can you please be more specific where i need to change the default header height value.
2.In the print preview of the report it looks fine but when i say file>print preview from internet explorer it is considering the logo as seperate page .Do i need to make any settings somewhere.
3.In the print preview it remains same eventhough i use the same stylesheet as that of the report.
Please advice.
Thank you,
Raja -
PDF Print Preview add doc title?
XI31 SP3
Requirement is to add the doc title when the document is printed, but not on the document itself. Is it possible to add a doc title to a pdf file without having the title actually on the document itself???You get a Pop up because you might have other actions ( fax or mail ) for which smartforms are attached and you can preview them.
Check your action config and Smartform to make sure there are no errors. If you can preview the form in GUI , you should be able to preview the same in Web. -
Hi All
Can any one tel how to print pdf file through smartform .
while executing the prog it goes to printerHi!
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
* IMPORTING
* BIN_FILESIZE =
* BIN_FILE =
TABLES
otf = i_otf
lines = i_pdf
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
SMARTFORMS TO PDF
Try this ....it converts form to PDF. -
Smart form print preview in PDF format
Hi ABAP Experts,
I have 2 requirements
1) I want to print preview of a smartform in pdf format
2) I also want to attach a local pdf file to the smartform which is displaying in the pdf print preview format
or to rephrase:
I want a pdf attached to a smartform which i want to open in the pdf print preview format.
Regards,
NilouferUse following function modules:
Please see the below code to download a PDF file on to your computer.
PERFORM F_CONVERT_OTF.
FORM F_CONVERT_OTF .
PERFORM F_CALL_SMARTFORM. " Call the smartform to get data in I_OTF_FINAL
**appending the otf data into the final table & save the pdf file.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = C_PDF_U "Value is 'PDF'
IMPORTING
BIN_FILESIZE = L_BIN_FILESIZE "L_BIN_FILESIZE TYPE I,
TABLES
OTF = I_OTF_FINAL
LINES = I_PDF_TAB "It is of type TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
* Check if the file is already existing.
CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
EXPORTING
FNAME = L_FILE1 " Path where file is saved
IMPORTING
EXIST = L_RESULT
* ISDIR =
* FILESIZE =
EXCEPTIONS
FILEINFO_ERROR = 1
OTHERS = 2
PERFORM F_GUI_DOWNLOAD USING L_FILE.
ENDFORM.
FORM F_GUI_DOWNLOAD USING P_FILE TYPE STRING.
CONSTANTS: C_BIN(10) TYPE C VALUE 'BIN'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = P_FILE "same as L_FILE
FILETYPE = C_BIN
CONFIRM_OVERWRITE = C_X "value 'X'
TABLES
DATA_TAB = I_PDF_TAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<removed by moderator>
Edited by: vishalmurgai58 on Mar 6, 2012 1:43 PM
Edited by: Thomas Zloch on Mar 6, 2012 - please do not ask for ... -
How do we view smartform output without clicking print preview
how can we view form without using print preview
Thanks in advanceUse 'TEST' button (F8) that is placed on the toolbar - have to use it few times to get to the preview.
You can fill there your data fields (or not) and see preview of the smartform
(use 'Print preview' when it will ask about the printer)
It's also helpful for debugging problems (f.e. table width isn't matching window width) when the form is not printing in it's main program - it writes You the problem.
Maybe you are looking for
-
Goods Receipt for sales order stock
Hi everybody, I want to receive materials for sales order stock. what I did: 1- Created a Purchase order, 2- Account Assignment = C 3- went to MIGO 4- selected PO number 5- set movement type 101 / E the SAP give error message that you have not planne
-
My iphone screen has gone completely blank I have tried holding down both the sleep and home buttons and nothing has happened and I have tried to connect it to my laptop but itunes will not recognise, what can I do ?
-
Hello I have a noob problem. I am trying to create an image button in my JSP page. I want to have an image as the background for the button with dynamic text on top of the image (in the foreground). This is what I have so far. <html:link href="javasc
-
How to customize the infoview and dashboards.
Post Author: [email protected] CA Forum: WebIntelligence Reporting Hi all, how to customize the infoview and dashboards. scenerio1: all users should have same look & feel of infoview. - please tell me the steps how set the preferences for this scene
-
hi i am using JDEV 11.1.1.3 i have a task flow which has a CREATE INSERT Method flow to my page. i am using go link in my menu i want 2 call that task flow so that i get a create form on page load... i dont know how to call the task flow.. is there i