Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

smart form pdf file opening error

Former Member
0 Likes
665

hi!

i developed a smart form and converted to pdf file and downloaded the same into my desktop using GUI_DOWNLOAD fn module .but when im trying to open the file a pop up is appearing stating that the file is damaged.wat could be the problem.plz help me....

thank in advance...

regards,

DurgaPrasad.K

hi!

i developed a smart form and converted to pdf file and downloaded the same into my desktop using GUI_DOWNLOAD fn module .but when im trying to open the file a pop up is appearing stating that the file is damaged.wat could be the problem.plz help me....

thank in advance...

regards,

DurgaPrasad.K

3 REPLIES 3
Read only

Manohar2u
Active Contributor
0 Likes
602

If you paste the code would be good to identify the problem

Here are the steps to convert to PDF, I guess there is a problem while converting.

1. call the smart form FM

call function '/xxx/xxxx'
EXPORTING
user_settings = space
control_parameters = control_parameters
output_options = output_options
IMPORTING
job_output_info = output_data
TABLES
zsystems = lt_sys
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.

2. convert the OTF data to PDF

call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = l_pdf_len
bin_file = l_pdf_xstring
TABLES
OTF = OUTPUT_DATA-OTFDATA
LINES = LT_LINES
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5.

Regds

Manohar

Read only

Former Member
0 Likes
602

Hi

I've used this code in my report and it works fine:

CALL FUNCTION w_nameform

EXPORTING

output_options = output_options

....................................

IMPORTING

job_output_info = job_output_info

....................................

TABLES

....................................

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc = 0.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = filesize

TABLES

otf = job_output_info-otfdata

doctab_archive = doctab_archive

lines = t_pdf

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 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.

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

bin_filesize = filesize

filename = filename

filetype = 'BIN'

CHANGING

data_tab = t_pdf

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.

  • Open file

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

commandline = filename

program = 'AcroRd32.exe'

EXCEPTIONS

frontend_error = 1

no_batch = 2

prog_not_found = 3

illegal_option = 4

gui_refuse_execute = 5

OTHERS = 6.

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.

Max

ENDIF.

Read only

Former Member
0 Likes
602

Hi DurgaPrasad,

PDF File opening error occurs when the file was created with empty data. I guess the internal table you were passing to PDF was empty.

Please check if you have enabled following option before calling Smart Form function module.

CONTROL_PARAMETERS-GETOTF = 'X'

Also make sure that you get the OTF data back from following internal table.

JOB_OUTPUT_INFO-OTFDATA

Sanjeev.

Message was edited by: Sanjeev K