Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question