cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of SMARTFORM to PDF file?

Former Member
0 Kudos

Hello

I have designed a PO smartform and i have configured NACE to call PO in ME22N. Here i want to convert the smartform that display when i am clicking print preview into PDF how can i achieve this please helpme.

Thks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try the code given below.

ls_control_param-getotf = 'X'.

ls_control_param-no_dialog = 'X'.

ls_control_param-preview = 'X'.

-----Get OTF data--


CALL FUNCTION lf_fm_name

EXPORTING

control_parameters = ls_control_param

output_options = wa_options

user_settings = ' '

IMPORTING

job_output_info = job_output_info

TABLES

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

it_otf[] = job_output_info-otfdata[].

--


Format data--

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = bin_filesize

TABLES

otf = it_otf[]

lines = it_lines

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.

--


Download the file--

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = bin_filesize

filename = filename

filetype = 'BIN'

TABLES

data_tab = it_lines

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.

ENDIF.

Edited by: Anil Mane on Aug 6, 2008 8:42 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Go through the link given below :

With Regards

Nikunj Shah

Former Member
0 Kudos

Hello,

This should be useful.

http://saptechnical.com/Tutorials/Smartforms/OTF2PDF.htm

Regards,

Nisrin.

Former Member
0 Kudos

Hi,

Please go through these links.

Thanks,