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

send smartforms via email

Former Member
0 Likes
790

Hi,

can anyone tell me how to send an smartform to an external email.

Here my DISPLAY report:

TABLES: MARA.

*

DATA: SSFCTRLOP LIKE SSFCTRLOP.

DATA: SWOTOBJID like SWOTOBJID.

*

DATA: IMARA TYPE TABLE OF MARA.

*

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

INITIALIZATION.

*

SSFCTRLOP-NO_DIALOG = 'X'.

SSFCTRLOP-PREVIEW = 'X'.

*

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

START-OF-SELECTION.

*

SELECT * FROM MARA INTO TABLE IMARA UP TO 10 ROWS.

*

CALL FUNCTION '/1BCDWB/SF00000003'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = SSFCTRLOP

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT = SWOTOBJID

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

ADRNR = '0000012427'

STR_POBOX = 'S'

TABLES

TMARA = IMARA.

*

END-OF-SELECTION.

i will send the smartform for example direct to [email protected].

Is that possible, and when yes, wich paramater must i fill?

thanks.

Regards, Dieter

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
730

Hello,

Please chekc this thread.

Vasanth

Hi,

can anyone tell me how to send an smartform to an external email.

Here my DISPLAY report:

TABLES: MARA.

*

DATA: SSFCTRLOP LIKE SSFCTRLOP.

DATA: SWOTOBJID like SWOTOBJID.

*

DATA: IMARA TYPE TABLE OF MARA.

*

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

INITIALIZATION.

*

SSFCTRLOP-NO_DIALOG = 'X'.

SSFCTRLOP-PREVIEW = 'X'.

*

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

START-OF-SELECTION.

*

SELECT * FROM MARA INTO TABLE IMARA UP TO 10 ROWS.

*

CALL FUNCTION '/1BCDWB/SF00000003'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = SSFCTRLOP

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT = SWOTOBJID

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

ADRNR = '0000012427'

STR_POBOX = 'S'

TABLES

TMARA = IMARA.

*

END-OF-SELECTION.

i will send the smartform for example direct to [email protected].

Is that possible, and when yes, wich paramater must i fill?

thanks.

Regards, Dieter

5 REPLIES 5
Read only

Former Member
0 Likes
731

Hello,

Please chekc this thread.

Vasanth

Read only

Former Member
0 Likes
730

Hi Dieter,

You need to convert your smart form OTF output to XSF and then send it.

Please check demo program SF_XSF_DEMO_MAIL.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
730

Hi Dieter,

Check the following code. It sends the smartfrom output as Email.

START-OF-SELECTION.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z_SMTF

IMPORTING

fm_name = v_fname.

CALL FUNCTION v_fname

EXPORTING

control_parameters = x_ctrl_p

IMPORTING

job_output_info = x_output_data.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 134

IMPORTING

bin_filesize = v_size

TABLES

otf = x_output_data-otfdata

lines = it_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4.

CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'

EXPORTING

line_width_dst = 255

TABLES

content_in = it_lines

content_out = it_soli

EXCEPTIONS

err_line_width_src_too_long = 1

err_line_width_dst_too_long = 2

err_conv_failed = 3

OTHERS = 4.

CALL FUNCTION 'ZFUNC_CONVERT_DATA_ODC01'

EXPORTING

iv_byte_mode = 'X'

TABLES

it_data = it_lines

et_data = it_table.

*-----To caluculate total number of lines of internal table

DESCRIBE TABLE it_table LINES v_lines.

*-----Function module to download the output file.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

bin_filesize = v_size

filename = ' '

filetype = 'BIN'

IMPORTING

act_filename = v_filename

TABLES

data_tab = it_lines.

*-----Create Message Body and Title and Description

it_mess =

'i have successfully converted smartform from otf format to pdf' .

" and i have attached that in mail'.

APPEND it_mess.

wa_doc_data-obj_name = 'smartform'.

wa_doc_data-expiry_dat = sy-datum + 10.

wa_doc_data-obj_descr = 'smartform'.

wa_doc_data-sensitivty = 'F'.

wa_doc_data-doc_size = v_lines * 255.

APPEND it_pcklist.

*-----PDF Attachment

it_pcklist-transf_bin = 'X'.

it_pcklist-head_start = 1.

it_pcklist-head_num = 0.

it_pcklist-body_start = 1.

it_pcklist-doc_size = v_lines_bin * 255 .

it_pcklist-body_num = v_lines.

it_pcklist-doc_type = 'PDF'.

it_pcklist-obj_name = 'smartform'.

it_pcklist-obj_descr = 'smart_desc'.

it_pcklist-obj_langu = 'E'.

it_pcklist-doc_size = v_lines * 255.

APPEND it_pcklist.

*-----Giving the receiver email-id

CLEAR it_receivers.

it_receivers-receiver = '[email protected]'.

it_receivers-rec_type = 'U'.

APPEND it_receivers.

*-----Calling the function module to sending email

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = wa_doc_data

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = it_pcklist

contents_txt = it_mess

contents_hex = it_table

receivers = it_receivers

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.

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = 'X'

WITH rfcgroup = 'iwdf7ytc_YD3_94'

AND RETURN.

REFRESH: it_receivers,

it_mess,

it_pcklist.

ENDIF.

Ashvender

Read only

Former Member
0 Likes
730

Hi,

thanks for your answers, but i'm searching for an possibility

to use direct the parameters MAIL_APPL_OBJ MAIL_RECIPIENT and

MAIL_SENDER to send it.

Is'nt it possible?

Regards, Dieter

Read only

0 Likes
730

Hi Dieter,

The function module names you have mentioned does not exists in ECC6.0,

So I am not sure weather you can use or not. But in ECC 6.0 following function module is available 'SO_NEW_DOCUMENT_ATT_SEND_API1' for sending emails.

Ashvender