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: 

How to see preview of smartform on pdf or xml format?

Former Member
0 Kudos

I have developed a few smartforms and now i need to generate the preview of the forms in PDF format and XML format, i understand that there are a function modules one can use to this end, can anyone please help out with the name of the function modules ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

You can't see preview in this format, because you should print the document before converting it.

A) PDF format:

- You can convert the spool by fm CONVERT_OTFSPOOLJOB_2_PDF, anyway see the std program RSTXPDFT4

- You can directly create a PDF file using type device ZPDF

B) XML

- you can directly create an XLM file arranging your smartforms for XST output.

Max

7 REPLIES 7

Former Member
0 Kudos

Hi

You can't see preview in this format, because you should print the document before converting it.

A) PDF format:

- You can convert the spool by fm CONVERT_OTFSPOOLJOB_2_PDF, anyway see the std program RSTXPDFT4

- You can directly create a PDF file using type device ZPDF

B) XML

- you can directly create an XLM file arranging your smartforms for XST output.

Max

0 Kudos

Hi Max,

I am trying to use the fm CONVERT_OTFSPOOLJOB_2_PDF, in the standard prog RSTXPDFT4 they are simply taking the spoolid from the user through the selection screen, now i am using this fm just after the call to the smartform function module in my sf print program, now what to do i pass as the spoolid to the src_spoolid field of CONVERT_OTFSPOOLJOB_2_PDF at this stage, possibly i am completely offtrack.

0 Kudos

U Can use the following FM without using the spool id.

data: cancel,

w_indvqt(1),

w_filesize type i,

i_otf type itcoo occurs 0 with header line,

i_tline type table of tline with header line,

wa_ssfctrlop type ssfctrlop, "control parameters

wa_ssfcresop type ssfcresop, "job o/p options

wa_ssfcrescl type ssfcrescl, "job output (among others otf data)

wa_ssfcompop type ssfcompop,

wf_spono type rspoid occurs 0 with header line.

data: filepdf like rlgrap-filename.

    • Convert to PDF document

if v_okcode = c_okcode_pdfdl.

  • Check whether spool is generated

call function 'CONVERT_OTF_2_PDF'

exporting

use_otf_mc_cmd = 'X'

  • ARCHIVE_INDEX =

importing

bin_filesize = w_filesize

tables

otf = wa_ssfcrescl-otfdata

doctab_archive = w_doctab_archive

lines = i_tline

exceptions

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

others = 3.

if sy-subrc ne 0.

w_retcode = 1.

message i006(zvq).

endif.

  • Download the PDF file generated.

call function 'DOWNLOAD'

exporting

bin_filesize = w_filesize

filename = filepdf

filetype = 'BIN'

importing

act_filename = filepdf

filesize = w_filesize

cancel = cancel

tables

data_tab = i_tline

exceptions

invalid_filesize = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

customer_error = 7.

if sy-subrc = 0 and cancel eq space.

write: / w_filesize, 'bytes downloaded into file'(009), filepdf.

w_downloaded = 'X'.

else.

w_retcode = 1.

message i007(zvq).

endif.

else.

if wa_ssfcrescl-outputdone = 'X'.

w_printed = 'X'.

endif.

endif.

0 Kudos

Hi Ateeq,

what are you feeding into doc_archive table, what is w_doctab_archive what is contained in it? or are you just importing stuff into it.?

0 Kudos

Hi Ateeq,

Thanks i am able to get the output in pdf format now.

0 Kudos

Hi Rudra,

I have a requirement to see the preview of a smartform in the pdf format with an option to print it.

I hope u have done a similar object, so can you please help me on this

If possible send it to my mail id: anilwaits4u@gmail.com

0 Kudos

Hi

Hasmath

i am getting out put but is not in PDF format.

could you pls help me out where is error ?

ata:fm_name type rs38l_fnam.

data : otf like ITCOO occurs 0.

data : DOCTAB_ARCHIVE like DOCS occurs 0.

data : LINES like tline occurs 0.

data: st_job_output_info TYPE ssfcrescl,

v_bin_filesize TYPE i,

CONTROL_PARAMETERS type SSFCTRLOP,

OUTPUT_OPTIONS type SSFCOMPOP,

DOCUMENT_OUTPUT_INFO type SSFCRESPD,

JOB_OUTPUT_INFO type SSFCRESCL,

JOB_OUTPUT_OPTIONS type SSFCRESOP,

v_filename like rlgrap-filename.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZSAS_TEST7'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 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 FUNCTION FM_NAME

EXPORTING

  • ARCHIVE_INDEX = ARCHIVE_INDEX

  • ARCHIVE_INDEX_TAB = ARCHIVE_INDEX_TAB

  • ARCHIVE_PARAMETERS = ARCHIVE_PARAMETERS

CONTROL_PARAMETERS = CONTROL_PARAMETERS

  • MAIL_APPL_OBJ = MAIL_APPL_OBJ

  • MAIL_RECIPIENT = MAIL_RECIPIENT

  • MAIL_SENDER = MAIL_SENDER

OUTPUT_OPTIONS = OUTPUT_OPTIONS

  • USER_SETTINGS = 'X'

IMPORTING

DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

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

CALL FUNCTION 'CONVERT_OTF_2_PDF'

EXPORTING

USE_OTF_MC_CMD = 'PDF'

  • ARCHIVE_INDEX = ARCHIVE_INDEX

  • IMPORTING

  • BIN_FILESIZE = BIN_FILESIZE

TABLES

OTF = OTF

DOCTAB_ARCHIVE = DOCTAB_ARCHIVE

LINES = LINES

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 FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = v_bin_filesize

filename = v_filename

filetype = 'ASC'

IMPORTING

FILELENGTH = v_filename

TABLES

data_tab = lines.

Thanks