Application Development 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: 

smartform pdf conversion in background

Former Member
0 Kudos

Hi All,

I've Two questions here

1) I would like to convert PDF file from the form in the Background mode.What are all the parameters that we have to set for the background its working fine.

2) I've the same form in the foreground which will display the preview once its being checked it has to ask for the pop up to get the path to store it as a pdf now its coming fine. I'm getting the dialog box again even if i say no_dialog 'X'

If anybody come across these two issues please reply as soon as possible.

cheers

Anand

2 REPLIES 2

Former Member
0 Kudos

Hi Anand,

Refer this code for your requirement.

*****

&----


*& Form get_spool

&----


  • Get the spool and convert into PDF

----


FORM get_spool .

READ TABLE job_output_info-spoolids INDEX 1 INTO rspoid.

spoolreq-rqident = rspoid.

spoolreq-sys = sy-sysid.

IF sy-subrc = 0.

SELECT SINGLE * FROM tsp01 WHERE rqident = rspoid.

client = tsp01-rqclient.

name = tsp01-rqo1name.

CALL FUNCTION 'RSTS_GET_ATTRIBUTES'

EXPORTING

authority = 'SP01'

client = client

name = name

part = 1

IMPORTING

type = type

objtype = objtype

EXCEPTIONS

fb_error = 1

fb_rsts_other = 2

no_object = 3

no_permission = 4.

IF objtype(3) = 'OTF'.

isotf = 'X'.

ELSE.

isotf = space.

ENDIF.

IF isotf = 'X'.

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = rspoid

no_dialog = ' '

IMPORTING

pdf_bytecount = pdf_bytecount

pdf_spoolid = pdf_spoolid

btc_jobname = btc_jobname

btc_jobcount = btc_jobcount

TABLES

pdf = pdf

EXCEPTIONS

err_no_otf_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_dstdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11.

CALL FUNCTION 'RSPO_IDELETE_SPOOLREQ'

EXPORTING

spoolreq = spoolreq

EXCEPTIONS

OTHERS = 2.

ENDIF.

v_fname = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = pdf_bytecount

filename = v_fname

filetype = 'BIN'

TABLES

data_tab = 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 i000 WITH 'PDF file downloaded error'.

ELSE.

MESSAGE i000 WITH 'PDF file downloaded successfully'.

ENDIF.

ENDIF.

ENDFORM. " get_spool

*****

Regards,

Raj

Former Member
0 Kudos

U can have one parameter for the file name to be stored.

that u can use in the PDF fileformat conversion.

I have used like this.So that i can store the file in any place.