on 07-31-2008 12:21 PM
I have written a program to send a mail from SAP. The mail is not getting triggerred.
This is my program .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default ' ' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
&----
*& Form POPULATE_MESSAGE_TABLE
&----
Adds text to email text table
----
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
&----
*& Form SEND_EMAIL_MESSAGE
&----
Send email message
----
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
&----
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
&----
Instructs mail send program for SAPCONNECT to send email.
----
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
In my SCOT settings i am not sure of the settings to be done.
I see one node SMTP defined in this transaction . The mail Host is given as mail.<company name>.com & the port is set as 25 & the code page is given as
1100 SAP internal , like ISO 8859- 1 (00697/00819).
WHen i execute this program i am getting a message saying ' NO Message Sent" ..
Pls help.
Regards & Thanks,
Kevin.
Dear Kevin,
Dont know why you have written an ABAP development for this.
You have to maintain user master record and do configuration in Tcode SCOT.
In Transation SCOT set code page as '0' i.e No conversion into other character sets.
Now under supported address type click 'SET' and put '*' there which means allowing all outgoing mails
Also check the name of the Default domain controller via(see top menu), click settings--> Default domain(it will be normally of the form<company name>.ac.in or <company name>.com)
If this also didn't work then read SAP notes:
455140 for more address specific information
487754 for any internal message error.
Surely surely your issue will be resolved.
PS: I still wonder why have you written ABAP for this.Co-ordinate with your BASIS guy
Regards,
Ashutosh
Edited by: ashutosh singh on Jul 31, 2008 1:54 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Follow the procedure on the SMTP Guide,
http://help.sap.com/saphelp_nw04s/helpdata/en/af/73563c1e734f0fe10000000a114084/content.htm
Regards
Juan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.