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 forms PDF

Former Member
0 Likes
991

Hi experts,

Iam trying to get the smartform into PDF.Iam working on VF02>billing doc>Issue output to...

Instead of going to spool request & RSTXPDFT4 program, i want to generate PDF in the output Message type itself.

So iam trying to modify SAP standard program RLB_INVOICE. Here iam confused that where to insert PDF function module and where have to make changes....to get report into PDF form??

Any suggestions pls...

thanks

kaki

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
906

There will be a parameter called GET_OTF which you need to set to X in the output_options / control_parameters. Once this is set, the output will be retruned in the ORFTABLE of the job_outputinfo parameter.

All this will happen when the smart form function is executed. Now take the OTFTABLE data and use the function CONVERT_OTF_2_PDF which will give the smart form in the PDF format.

Regards,

Ravi

Note : Please mark the helpful answers

4 REPLIES 4
Read only

Former Member
0 Likes
907

There will be a parameter called GET_OTF which you need to set to X in the output_options / control_parameters. Once this is set, the output will be retruned in the ORFTABLE of the job_outputinfo parameter.

All this will happen when the smart form function is executed. Now take the OTFTABLE data and use the function CONVERT_OTF_2_PDF which will give the smart form in the PDF format.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

Former Member
0 Likes
906

Refer this link:

Read only

Former Member
0 Likes
906

Hi

Insert a code like this after calling the smartforms:

CALL FUNCTION <SMARTFORM>

EXPORTING

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

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.

  • Convert to pdf forms

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.

  • download file

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.

You can also insert a module to opena dialog to choose the filename.

Max

Read only

0 Likes
906

Hi Ravikumar Allampallam ,Ravi Kanth Talagana ,max bianchi ..

Thanks for all the replies..

I got it.

Points alloted..

cheers

kaki