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

Report :pdf format

Former Member
0 Likes
461

hello Guys,

I need one report wch inter table to PDF ot HTML format.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
440

see this code it might be help you. it is for converting report to pDF format

w_cparam TYPE ssfctrlop,

w_outoptions TYPE ssfcompop,

w_bin_filesize TYPE i, " Binary File Size

w_file_name TYPE string,

w_file_path TYPE string,

w_full_path TYPE string,

t_otf[] = t_otf_from_fm-otfdata[].

  • Function Module CONVERT_OTF is used to convert the OTF format to PDF

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

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

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.

  • To display File SAVE dialog window

CALL METHOD cl_gui_frontend_services=>file_save_dialog

CHANGING

filename = w_file_name

path = w_file_path

fullpath = w_full_path

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

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

  • Use the FM GUI_DOWNLOAD to download the generated PDF file onto the

  • presentation server

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = w_bin_filesize

filename = w_full_path

filetype = 'BIN'

TABLES

data_tab = t_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 'I' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
441

see this code it might be help you. it is for converting report to pDF format

w_cparam TYPE ssfctrlop,

w_outoptions TYPE ssfcompop,

w_bin_filesize TYPE i, " Binary File Size

w_file_name TYPE string,

w_file_path TYPE string,

w_full_path TYPE string,

t_otf[] = t_otf_from_fm-otfdata[].

  • Function Module CONVERT_OTF is used to convert the OTF format to PDF

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

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

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.

  • To display File SAVE dialog window

CALL METHOD cl_gui_frontend_services=>file_save_dialog

CHANGING

filename = w_file_name

path = w_file_path

fullpath = w_full_path

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

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

  • Use the FM GUI_DOWNLOAD to download the generated PDF file onto the

  • presentation server

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = w_bin_filesize

filename = w_full_path

filetype = 'BIN'

TABLES

data_tab = t_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 'I' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Read only

Former Member
0 Likes
440

thanks