‎2007 May 15 7:02 AM
Hi Experts ,
i am using this RSCONN01 program for sending mails with the help of the functional Module 'SO_NEW_DOCUMENT_ATT_SEND_API1'
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'.
Is there any other way to do this without calling this program ?.
Scheduling this RSCONN01 in background will work ????
Kindly guide me.
Regards
Lakshmiraj
‎2007 May 15 8:32 AM
Hi,
Whenever you call the function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' the mail will go and sit in the SCOT transaction, from there you need to dispath the mail, for this one we call the program RSCONN01, so the mail will go directly, if you want to schedule this program then you need schedule this program after every run of the 'SO_NEW_DOCUMENT_ATT_SEND_API1' function module
Regards
Sudheer
‎2007 May 15 8:28 AM
Hi,
There is no need to use the program RSCONN01 for sending the mails. Only by using the function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'. you can send mails to the destination.
By creating the distribution list in so23 and maintaining the same in su01( by help of basis guy). you can send the mails.
Sample code
PERFORM send_mail USING c_business.
FORM send_mail USING receiver.
CLEAR: w_lines,tbl_packing_list,tbl_object_header,
tbl_contents_txt, tbl_receivers.
REFRESH:tbl_packing_list, tbl_object_header,
tbl_contents_txt,tbl_receivers.
SORT tbl_err.
DELETE ADJACENT DUPLICATES FROM tbl_err COMPARING ALL FIELDS.
IF NOT tbl_err[] IS INITIAL.
Preparing the email.
PERFORM prepare_email.
ELSE.
If sy-subrc NE 0.
MOVE sy-subrc TO w_code.
ENDIF.
EXIT.
ENDIF.
Get the content of header e-mail document data
PERFORM document_data.
Get details of the error file attached (like type of file and format)
PERFORM packing_list.
Get receiver mail id's
tbl_receivers-receiver = receiver.
tbl_receivers-rec_type = 'C'.
tbl_receivers-express = c_flag.
tbl_receivers-sap_body = c_flag.
APPEND tbl_receivers.
*
Call FM to send E-mails to receivers
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = st_document_data
put_in_outbox = 'X'
TABLES
packing_list = tbl_packing_list
object_header = tbl_object_header
contents_txt = tbl_contents_txt
receivers = tbl_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.
*
ENDFORM. " send_mail
FORM prepare_email.
E-Mail body content
IF NOT w_lifnr IS INITIAL.
CONCATENATE text-015 w_docnum text-016
INTO tbl_contents_txt-line
SEPARATED BY space.
ENDIF.
APPEND tbl_contents_txt.
CLEAR tbl_contents_txt.
*
E-mail error file attachment header
CONCATENATE text-063 text-064
text-065 text-066 c_comma
INTO tbl_contents_txt-line
SEPARATED BY c_comma.
APPEND tbl_contents_txt.
CLEAR tbl_contents_txt.
*
E-mail error file attachment content
LOOP AT tbl_err.
CONCATENATE w_docnum tbl_err-v_segnum
tbl_err-msg tbl_err-type
INTO tbl_contents_txt-line
SEPARATED BY c_comma.
CONCATENATE c_linefeed tbl_contents_txt-line c_comma
INTO tbl_contents_txt-line.
APPEND tbl_contents_txt.
CLEAR tbl_contents_txt.
ENDLOOP.
ENDFORM. " prepare_email
FORM document_data.
CLEAR w_line.
IF NOT w_lifnr IS INITIAL.
CONCATENATE text-075 text-027 sy-datum sy-uzeit INTO w_line
SEPARATED BY c_uscore.
ENDIF.
st_document_data-obj_name = w_line.
st_document_data-obj_descr = w_line.
st_document_data-priority = 1.
st_document_data-obj_prio = 1.
ENDFORM. " document_data
Thanks
manju.
‎2007 May 15 8:32 AM
Hi,
Whenever you call the function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' the mail will go and sit in the SCOT transaction, from there you need to dispath the mail, for this one we call the program RSCONN01, so the mail will go directly, if you want to schedule this program then you need schedule this program after every run of the 'SO_NEW_DOCUMENT_ATT_SEND_API1' function module
Regards
Sudheer