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

smartforms: send form via mail

Former Member
0 Likes
1,142

Hi,

I need help at filling structure of MAIL_SENDER, MAIL_RECIPIENT and MAIL_APPL_OBJ. Exist any Functionmodule for filling this field for sending forms with smartforms via email. How/where can I get the parameters info for MAIL_SENDER,MAIL_RECIPIENT and MAIL_APPL_OBJ?

Regards

Hüsniye

Hi,

I need help at filling structure of MAIL_SENDER, MAIL_RECIPIENT and MAIL_APPL_OBJ. Exist any Functionmodule for filling this field for sending forms with smartforms via email. How/where can I get the parameters info for MAIL_SENDER,MAIL_RECIPIENT and MAIL_APPL_OBJ?

Regards

Hüsniye

8 REPLIES 8
Read only

markus_meisl
Advisor
Advisor
0 Likes
1,015

Hello Hüsniye,

have you seen the documentation on this?

http://help.sap.com/saphelp_erp2004/helpdata/en/a5/28d3b9d26211d4b646006094192fe3/frameset.htm

Regards,

Markus Meisl

SAP NetWeaver Product Management

Read only

0 Likes
1,015

Hi,

yes I saw it, I configured it with DEVICE = 'MAIL', but the interface need MAIL_SEND and others are type of SWOTOBJID. The structure SWOTOBJID needs entries for LOGSYS,OBJTYPE,

OBJKEY, DESCRIBE. Logsys is known, but I don't know where tor read other information.

regards

hüsniye

Read only

0 Likes
1,015

If you want to email smartform

:

First get the otf

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

control_params-getotf = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZIADEFATURASI'

IMPORTING

fm_name = fm_name.

CALL FUNCTION fm_name

EXPORTING

control_parameters = control_params

output_options = output_options

user_settings = ' '

nast = nast

rbkp = rbkp

rbkpold = rbkpold

lfa1 = lfa1

IMPORTING

job_output_info = structjob

TABLES

rseg = itabrseg.

Second convert it to pdf

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

FORM convert_to_pdf .

DATA:

zlines TYPE TABLE OF tline WITH HEADER LINE,

size TYPE i,

zreceivers TYPE TABLE OF somlreci1 WITH HEADER LINE,

zdata TYPE sodocchgi1,

BEGIN OF zlines2 OCCURS 0,

tline TYPE char255,

END OF zlines2

.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = size

TABLES

otf = structjob-otfdata

lines = zlines.

  • PDF'i download et.

  • CALL FUNCTION 'DOWNLOAD'

  • EXPORTING

  • bin_filesize = size

  • filetype = 'BIN'

  • TABLES

  • data_tab = zlines.

zreceivers-receiver = '[email protected]'.

zreceivers-rec_type = 'U'.

APPEND zreceivers.

  • make each line 255 characters

CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'

TABLES

content_in = zlines

content_out = zlines2.

  • subject of mail and the name of document

zdata-obj_descr = nast-objky+4(10).

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = zdata

document_type = 'PDF'

commit_work = 'X'

TABLES

object_content = zlines2

receivers = zreceivers.

ENDFORM. " convert_to_pdf

Message was edited by: Fuat Ulugay

Read only

0 Likes
1,015

Hi,

tank you ver much, it was very helpfull.

Regards

Hüsniye

Read only

0 Likes
1,015

Hi,

I can edit the subject and attachment name with function module but is it possible to write Messages in Mail.

Regards

Hüsniye

Read only

0 Likes
1,015

Hi,

you can use the following function module to meet your requirement

'SO_NEW_DOCUMENT_ATT_SEND_API1'

Use the table 'contents_bin' for attachment and 'contents_txt ' for the message text.

good luck,

Suresh Datti

Read only

0 Likes
1,015

Here is an example to add text and to put a name to the attached file.

... Before that Get OTF ...

CLEAR: reclist, reclist[],

objhead, objhead[],

objtxt, objtxt[],

objbin, objbin[],

objpack, objpack[].

  • Create the PDF File

CLEAR objbin.

REFRESH objbin.

objbin[] = it_mess_att[].

DESCRIBE TABLE objbin LINES righe_attachment.

  • Text in the mail.

objtxt = 'Text - Line 1'.APPEND objtxt.

objtxt = 'Text - Line 2'.APPEND objtxt.

objtxt = 'Text- Line 3'.APPEND objtxt.

DESCRIBE TABLE objtxt LINES righe_testo.

  • Armo informacion del documento.

doc_chng-obj_name = 'URGENT'.

doc_chng-expiry_dat = sy-datum + 10.

CONCATENATE 'FILE_NAME' 'HELLO'

INTO doc_chng-obj_descr SEPARATED BY space.

doc_chng-sensitivty = 'F'.

doc_chng-doc_size = righe_testo * 255.

  • Create Pack to text in mail body.

CLEAR objpack-transf_bin.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

objpack-body_num = righe_testo.

objpack-doc_type = 'RAW'.

APPEND objpack.

  • Create Pack to PDF Attach.

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 1.

objpack-body_start = 1.

objpack-body_num = righe_attachment.

objpack-doc_type = 'PDF'.

objpack-obj_name = 'TEST'.

CONCATENATE 'File Name' '.pdf'

INTO objpack-obj_descr.

objpack-doc_size = righe_attachment * 255.

APPEND objpack.

CLEAR reclist.

reclist-copy = 'X'.

  • Receivers

reclist-receiver = '[email protected]'

reclist-express = 'X'.

reclist-rec_type = 'U'.

reclist-notif_del = 'X'. " request delivery notification

reclist-notif_ndel = 'X'. " request not delivered notification

APPEND reclist.

  • Send Mail.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_hex = objbin

contents_txt = objtxt

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

Regards

PabloX

Read only

0 Likes
1,015

Please, check it, is not file name, is mail subject:

  • Armo informacion del documento.

doc_chng-obj_name = 'URGENT'.

doc_chng-expiry_dat = sy-datum + 10.

CONCATENATE 'FILE_NAME' 'HELLO' *** Is mail SUBJECT

INTO doc_chng-obj_descr SEPARATED BY space.

doc_chng-sensitivty = 'F'.

doc_chng-doc_size = righe_testo * 255.