cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform OTF error

Former Member
0 Kudos

Hi,

I have followed the steps for converting a smartform to a PDF file. But the OTF data table is initial.

Can someone point me to what i am doing wrong?

Best regards

Lisa M Simonsen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this code in the initialisation of the code.

DATA: ws_ctrlpara TYPE ssfctrlop,

ws_opoption TYPE ssfcompop,

ws_opinfo TYPE ssfcrescl,

wi_otfdata TYPE tsfotf.

CLEAR ws_ctrlpara.

ws_ctrlpara-getotf = 'X'.

ws_ctrlpara-no_dialog = 'X'.

ws_ctrlpara-preview = space.

ws_opoption-tdprinter = text-element.

While calling smartform you call it like this:

CALL FUNCTION v_frmname

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = ws_ctrlpara

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = ws_opoption

user_settings = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = ws_opinfo

  • JOB_OUTPUT_OPTIONS =

TABLES

wi_invoice = wi_invoice1(table where data is stored)

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.

Then you write this:

MOVE ws_opinfo-otfdata[] TO wi_otfdata[].

Then you can use this FM:

CALL FUNCTION 'CONVERT_OTF_2_PDF'

EXPORTING

use_otf_mc_cmd = 'X'

IMPORTING

bin_filesize = wl_filesize

TABLES

otf = wi_otfdata

doctab_archive = wi_docs

lines = wi_mtab_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.

This will convert smartform into PDF.

Now the table wi_mtab_pdf will contain the PDF form and you can download it using gui_download fm.

Hope this help.

Reward if useful.

Sushil

Former Member
0 Kudos

Hi,

Thank you for your answer. I have filled all the fields you suggested, but the OTF table in the job_output_info is still empty. And when it is empty a empty PDF is attached to the email.

Any other suggestions?

Best Regards

Lisa M Simonsen

Answers (2)

Answers (2)

Former Member
0 Kudos

it helps when one uncomments the expoting parameters of the FM

Former Member
0 Kudos

Hi Lisa Mari,

Do you parameter this ( <i>At the Samrtforms FM call</i> 😞

st_ssfctrlop-getotf = 'X'

?

And do you retrieve in the following table : st_ssfcrescl-otfdata. ?

Erwan

Former Member
0 Kudos

Hi Erwan,

Yes i do but the table is initial.

Best regards

Lisa M Simonsen

Former Member
0 Kudos

Hi Again,

Do you have any other suggestions?

Best regards

Lisa M Simonsen