cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Smartforms to PDF and displaying Smartforms on print preview

Former Member
0 Kudos

Hi,

How to convert smartforms to pdf?

How to attach this pdf to email?

How to attach this pdf to the email and at the same time can print preview the smartforms?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'Form name'

IMPORTING

FM_NAME = v_FUNCTION

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 v_FUNCTION

EXPORTING

CONTROL_PARAMETERS =

OUTPUT_OPTIONS =

USER_SETTINGS = 'X'

IMPORTING

JOB_OUTPUT_INFO =

TABLES

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.

This is how u call your smart form converting it to PDF o/p

To email do this

CALL FUNCTION 'Z_SY_EMAIL_SFORM_AS_PDF'

EXPORTING

TABLES

T_RECEIVERS =

T_MSG_BODY =

T_OTF =

EXCEPTIONS

ERR_NO_ABAP_SPOOLJOB = 1

ERR_NO_SPOOLJOB = 2

ERR_NO_PERMISSION = 3

ERR_CONV_NOT_POSSIBLE = 4

ERR_BAD_DESTDEVICE = 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

TOO_MANY_RECEIVERS = 12

DOCUMENT_NOT_SENT = 13

DOCUMENT_TYPE_NOT_EXIST = 14

OPERATION_NO_AUTHORIZATION = 15

PARAMETER_ERROR = 16

X_ERROR = 17

ENQUEUE_ERROR = 18

ERR_OTF_MC_NOENDMARKER = 19

OTHERS = 20.

IF SY-SUBRC <> 0.

if ( not SY-MSGID is initial ) and ( not SY-MSGTY is initial ).

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

else.

write:/ 'FM failed with error:',

sy-subrc .

endif.

ENDIF.

Answers (5)

Answers (5)

Former Member
0 Kudos

SAP docum,

If the GETOTF parameter is set, SAP Smart Forms ignores the setting of the DEVICE parameter of the control structure. You cannot have the OTF table returned to you and send the form to an output device. Furthermore, you cannot have the form returned in both OTF and other output formats in one call of the generated function module.

But, the SSF returns the spool number that has been created.

You can get the spool and transform it to PDF.

************************

method get_otf_data.

data : lt_soli type standard table of soli.

call function 'RSPO_RETURN_SPOOLJOB'

exporting

rqident = me->as_tsp01-rqident

desired_type = 'OTF'

tables

buffer = lt_soli

exceptions

no_such_job = 1

job_contains_no_data = 2

selection_empty = 3

no_permission = 4

can_not_access = 5

read_error = 6

type_no_match = 7

others = 8.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

raising error_found.

endif.

et_otf[] = lt_soli[].

endmethod.

**************************************

method convert_otf_to_pdf .

data : it_docs type standard table of docs,

it_bindata type standard table of tline.

data : l_length type i.

  • CONVERT OTF TO PDF XSTRING

  • --------------------------

call function 'CONVERT_OTF'

exporting

format = 'PDF'

importing

bin_filesize = l_length

bin_file = o_result

tables

otf = it_i_otf

lines = it_bindata

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

raising error_found.

endif.

endmethod.

Former Member
0 Kudos

Hi Navi,

Check this link for conversion of smartform to PDF.

Nayan

Former Member
0 Kudos

Hi

To convert smartform output to PDF check with this:

Please do the following:

1. Print the smartform to the spool.

2. Note the spool number.

3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the

noted spool number.

or use this program:

&----


*& Report ZPDF_DNLD_TEST2 *

*& *

&----


*& DEVK904540 *

*& *

&----


REPORT ZPDF_DNLD_TEST2 .

data: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE,

i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.

data: op_option type SSFCTRLOP,

job_output type SSFCRESCL.

op_option-getotf = 'X'.

CALL FUNCTION '/1BCDWB/SF00000005'

EXPORTING

ARCHIVE_INDEX =

ARCHIVE_INDEX_TAB =

ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = op_option

MAIL_APPL_OBJ =

MAIL_RECIPIENT =

MAIL_SENDER =

OUTPUT_OPTIONS =

USER_SETTINGS = 'X'

itab1 = itab1

IMPORTING

DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = job_output

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'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

ARCHIVE_INDEX = ' '

COPYNUMBER = 0

ASCII_BIDI_VIS2LOG = ' '

PDF_DELETE_OTFTAB = ' '

IMPORTING

BIN_FILESIZE =

BIN_FILE =

TABLES

otf = job_output-otfdata

lines = i_pdf

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.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE =

filename = 'c:\test_pdf_sf.pdf'

FILETYPE = 'BIN'

tables

data_tab = i_pdf

FIELDNAMES =

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.

ENDIF.

Reward points if helpful

Regards

Vachana Jawaji

Former Member
0 Kudos

Hi Navi,

Code Snippet for Simple Mail

&----


*& Report ZZ_TEST *

*& *

&----


*& *

*& *

&----


REPORT zz_test .

INCLUDE zz_test_top.

INCLUDE zz_test01.

----


  • FORM entry *

----


  • ........ *

----


  • --> RETURN_CODE *

  • --> US_SCREEN *

----


FORM entry USING return_code us_screen.

CLEAR retcode.

xscreen = us_screen.

PERFORM processing USING us_screen.

CASE retcode.

WHEN 0.

return_code = 0.

WHEN 3.

return_code = 3.

WHEN OTHERS.

return_code = 1.

ENDCASE.

ENDFORM. "entry

&----


*& Include ZZ_TEST_TOP *

&----


TABLES : nast,

tnapr.

TYPES : BEGIN OF t_SOUDNAMEI1.

INCLUDE STRUCTURE SOUDNAMEI1.

TYPES : END OF t_SOUDNAMEI1.

  • Internal Table declarations

DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

i_tline TYPE TABLE OF tline WITH HEADER LINE,

i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,

i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,

*Objects to send mail.

i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,

i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,

i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,

i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,

i_lips LIKE lips OCCURS 0 WITH HEADER LINE,

i_SOUDNAMEI1 TYPE STANDARD TABLE OF t_SOUDNAMEI1.

  • Work Area declarations

DATA:w_objhead TYPE soli_tab,

wa_control_parameters TYPE ssfctrlop,

wa_output_options TYPE ssfcompop,

w_return TYPE ssfcrescl,

w_doc_chng TYPE sodocchgi1,

w_data TYPE sodocchgi1,

w_buffer TYPE string,"To convert from 132 to 255

wa_SOUDNAMEI1 TYPE t_SOUDNAMEI1,

  • Variables declarations

w_form_name TYPE rs38l_fnam,

w_len_in LIKE sood-objlen,

w_len_out LIKE sood-objlen,

w_len_outn TYPE i,

w_lines_txt TYPE i,

w_lines_bin TYPE i,

retcode TYPE sy-subrc,

xscreen TYPE c,

w_spld TYPE usr01-spld,

w_receiver TYPE SOXNA-FULLNAME,

w_OBJ_RECORD TYPE OBJ_RECORD,

w_user type sy-uname,

w_email TYPE ad_smtpadr.

  • Constants Declaration

CONSTANTS : c_x TYPE c VALUE 'X',

c_atrate(1) TYPE c VALUE '@'.

&----


*& Include ZZ_TEST01 *

&----


----


  • FORM PROCESSING *

----


FORM processing USING proc_screen.

SELECT * FROM lips

INTO TABLE i_lips

WHERE vbeln = nast-objky.

  • Call Function module to Getfunction Module name Generated by Smartform

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = tnapr-sform

IMPORTING

fm_name = w_form_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

retcode = sy-subrc.

ENDIF.

CLEAR : wa_control_parameters,

wa_output_options.

CASE nast-nacha.

WHEN '1'.

wa_control_parameters-device = 'PRINTER'.

WHEN '7'.

DATA: l_email TYPE ad_smtpadr.

wa_output_options-tdnoprev = c_x.

wa_control_parameters-getotf = c_x.

  • To get the default output device maintained in the

  • User profile

SELECT SINGLE spld FROM usr01

INTO w_spld

WHERE bname EQ nast-usnam.

IF sy-subrc EQ 0.

MOVE w_spld TO wa_output_options-tddest .

ENDIF.

wa_output_options-tdnoprev = c_x.

wa_control_parameters-getotf = c_x.

  • To get the email address maintained for the particular output

CALL FUNCTION 'NAST_GET_MESSAGE_OBJECT_RECV'

EXPORTING

pi_objkey = nast-tdname

IMPORTING

pe_addr = w_receiver

CHANGING

pc_objhandle = w_obj_record

EXCEPTIONS

maildata_not_readable = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

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

ENDIF.

IF w_receiver NA c_atrate.

  • To retrieve the E-Mail Id in case we get the User name from NAST

CLEAR wa_soudnamei1.

REFRESH i_soudnamei1.

MOVE w_receiver TO wa_soudnamei1-fullname.

  • To get the user name

CALL FUNCTION 'SO_NAME_CONVERT_API1'

EXPORTING

name = wa_soudnamei1

TABLES

names = i_soudnamei1

EXCEPTIONS

user_not_exist = 1

parameter_error = 2

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

CLEAR wa_soudnamei1.

READ TABLE i_soudnamei1 INTO wa_soudnamei1 INDEX 1.

MOVE wa_soudnamei1-sapname TO w_user.

  • To get the e-mail Id maintained in the user profile

CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'

EXPORTING

i_user = w_user

IMPORTING

e_email_address = l_email

EXCEPTIONS

mail_address = 1

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

MOVE l_email TO w_receiver.

ENDIF.

MOVE w_receiver TO w_email.

ENDCASE.

wa_control_parameters-no_dialog = c_x.

wa_control_parameters-langu = nast-spras .

wa_output_options-tdteleland = nast-tland.

wa_output_options-tdtelenum = nast-telfx .

wa_output_options-tdsenddate = nast-erdat .

wa_output_options-tdsendtime = nast-eruhr .

wa_output_options-tddataset = nast-dsnam .

wa_output_options-tdsuffix1 = nast-dsuf1 .

wa_output_options-tdsuffix2 = nast-dsuf2 .

wa_output_options-tdimmed = nast-dimme .

wa_output_options-tddelete = nast-delet .

wa_output_options-tdautority = nast-tdautority.

wa_output_options-tdcovtitle = nast-tdcovtitle .

wa_output_options-tdcover = nast-tdocover .

wa_output_options-tdreceiver = nast-tdreceiver.

wa_output_options-tddivision = nast-tddivision.

wa_output_options-tdcopies = nast-anzal .

wa_output_options-tdnewid = c_x.

wa_output_options-tdarmod = nast-tdarmod.

wa_output_options-tdnoarmch = c_x.

CALL FUNCTION w_form_name

EXPORTING

  • archive_index = toa_dara

  • archive_parameters = arc_params

control_parameters = wa_control_parameters

output_options = wa_output_options

user_settings = ' '

IMPORTING

job_output_info = w_return

TABLES

it_lips = i_lips

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF nast-nacha EQ 7 AND sy-subrc EQ 0.

i_otf[] = w_return-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = w_len_in

TABLES

otf = i_otf

lines = i_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

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

  • Convert PDF from 132 to 255.

LOOP AT i_tline.

  • Replacing space by ~

TRANSLATE i_tline USING ' ~'.

CONCATENATE w_buffer i_tline INTO w_buffer.

ENDLOOP.

  • Replacing ~ by space

TRANSLATE w_buffer USING '~ '.

DO.

i_record = w_buffer.

  • Appending 255 characters as a record

APPEND i_record.

SHIFT w_buffer LEFT BY 255 PLACES.

IF w_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

REFRESH: i_reclist,

i_objtxt,

i_objbin,

i_objpack.

CLEAR w_objhead.

  • Object with PDF.

i_objbin[] = i_record[].

DESCRIBE TABLE i_objbin LINES w_lines_bin.

  • Document information.

w_doc_chng-obj_name = 'Smartform'.

w_doc_chng-expiry_dat = sy-datum + 10.

CONCATENATE 'Delivery' 'Note'

INTO w_doc_chng-obj_descr.

*w_doc_chng-obj_descr = 'Smart form output'.

w_doc_chng-sensitivty = 'F'. "Functional object

w_doc_chng-doc_size = w_lines_txt * 255.

  • Pack to main body as RAW.

  • Obj. to be transported not in binary form

CLEAR i_objpack-transf_bin.

  • Start line of object header in transport packet

i_objpack-head_start = 1.

  • Number of lines of an object header in object packet

i_objpack-head_num = 0.

  • Start line of object contents in an object packet

i_objpack-body_start = 1.

  • Number of lines of the object contents in an object packet

i_objpack-body_num = w_lines_txt.

  • Code for document class

i_objpack-doc_type = 'RAW'.

APPEND i_objpack.

  • Packing as PDF.

i_objpack-transf_bin = 'X'.

i_objpack-head_start = 1.

i_objpack-head_num = 1.

i_objpack-body_start = 1.

i_objpack-body_num = w_lines_bin.

i_objpack-doc_type = 'PDF'.

i_objpack-obj_name = 'Smartform'.

CONCATENATE 'Delivery' 'Note' '.pdf'

INTO i_objpack-obj_descr.

i_objpack-doc_size = w_lines_bin * 255.

APPEND i_objpack.

  • Document information.

CLEAR i_reclist.

  • e-mail receivers.

i_reclist-receiver = w_email.

i_reclist-express = 'X'.

i_reclist-rec_type = 'U'. "Internet address

APPEND i_reclist.

  • sending mail.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = w_doc_chng

put_in_outbox = 'X'

TABLES

packing_list = i_objpack

object_header = w_objhead

contents_bin = i_objbin

  • contents_txt = i_objtxt

receivers = i_reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

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.

ENDFORM. "processing

OTF to PDF

========================================================================

Program1

&----


*& REPORT zpmm_print1

*&

&----


REPORT zpmm_print1.

DATA : gw_ssfcrescl TYPE ssfcrescl.

DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,

gt_tline TYPE STANDARD TABLE OF tline,

gv_len LIKE sood-objlen,

gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS

gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS

DATA fm_name TYPE rs38l_fnam.

gw_ssfctrlop-getotf = 'X'.

gw_ssfctrlop-no_dialog = 'X'.

gw_ssfcompop-tdnoprev = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZPMM_1'

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • <error handling>

ENDIF.

CALL FUNCTION fm_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = gw_ssfctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = gw_ssfcompop

user_settings = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = gw_ssfcrescl

  • 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.

gt_otf[] = gw_ssfcrescl-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = gv_len

TABLES

otf = gt_otf

lines = gt_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

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

DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

bin_filesize = gv_len

filename = gv_filename

filetype = 'BIN'

filetype_no_show = 'X'

IMPORTING

act_filename = gv_filename

filesize = gv_len

  • cancel = ''

TABLES

data_tab = gt_tline.

Program 2

&----


*& REPORT zpmm_print2

*&

&----


REPORT zpmm_print2.

DATA : gw_ssfcrescl TYPE ssfcrescl.

DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,

gt_tline TYPE STANDARD TABLE OF tline,

gv_len LIKE sood-objlen,

gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS

gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS

DATA fm_name TYPE rs38l_fnam.

gw_ssfctrlop-getotf = 'X'.

gw_ssfctrlop-no_dialog = 'X'.

gw_ssfcompop-tdnoprev = 'X'.

CALL FUNCTION '/1BCDWB/SF00000041'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = gw_ssfctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = gw_ssfcompop

user_settings = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = gw_ssfcrescl

  • 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.

gt_otf[] = gw_ssfcrescl-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = gv_len

TABLES

otf = gt_otf

lines = gt_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

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

DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

bin_filesize = gv_len

filename = gv_filename

filetype = 'BIN'

filetype_no_show = 'X'

IMPORTING

act_filename = gv_filename

filesize = gv_len

  • cancel = ''

TABLES

data_tab = gt_tline.

=========================================================================

Cheers

Mohinder Singh Chauhan

Former Member
0 Kudos

Check the reply in this link-

How to convert smartforms to pdf:

How to attach this pdf to email:

Reward all helpful replies.