Sending external email via SAPCONNECT
Hi all,
I want to know how to send external email through sap.
Thanks in advance,
Manosh.
HI,
Try this code:
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
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
Reward points if found helpful....
Cheers,
Chandra Sekhar.
Similar Messages
-
Sending external email from SAP with following requirements...
Hi All,
I need to send external emails from SAP by meeting following requirements.
1) With subject line more than 100 characters.
2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
3) Should be able to know the success/failure of mail sending at program level.Hi,
The code below demonstrates how to send an email to an external email address
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
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
Hope this helps.
Reward if helpful.
Regards,
Sipra -
To send external email from ABAP
How to send external email from ABAP Program and what are the settings to be done for the same ?
Please check..
Sending External email through SAP
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
How to send a report to an external mail-id?
Try this sample code :-
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = '[email protected]'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment. -
Unable to send out emails via outlook express since 06/29/2010
Task '[email protected]" - Sending' reported error (0x80042109) : 'Outlook is unable to connect to your outgoing (SMTP) e-mail server. If you continue to receive this message, contact your server administrator or Internet service provider (ISP).' This is a copy/paste of error message from Office Outlook 2003
Our household has been unable to "send" outgoing emails since 06/29/2010. This includes a wireless laptop and a PC. We both lost the ability to send emails same day. We changed NOTHING and did not share emails with each other that would have corrupted our system. During this time I have had 2 Verizon techs dance around in the PC doing all the same things I did as well as what the automated assistant did. The last tech said the Outlook Express 6.0 was corrupted, and to unistall it and then reinstall; this time 2 hours later, I think he just gave up). That did not work either. I tried using the Outlook Office and still got an error message for outging. Everything is set up as it was when it was working until 06/29/2010. I was told that there was a new server being installed and that things wold be working by 07/02/2010... I have tried taking down the firewall, turning off virus protection (McAfee), changing from outgoing.yahoo.verizon.net to just outgoing.verizon.net, checking boxes, unchecked boxes. SMPT is set to 587. We get incoming fine. I hate using the "Verizon email site" as too much monkey motion to get to mail, but that's what we have been doing. I even tried setting up a GMail account, again got mail still could not send. Any ideas?Thank you for your response! I even tried sending an email via dos prompt with Telnet, got past "HELO", but when trying to get a "RCPT TO" (using outgoing.yahoo.verizon.net) I got an "authorization required" response and then was dropped. I have been passed around without a solution. I am about ready to change ISP, but really hate to as most of the time (years now) this has been a decent ISP. If Verizon is having a problem just say so, I can handle it, honesty would be nice, refreshing and not wasting so much of my time as well as the techs!
-
Sending an email via AppleScript and Dialogue Boxes
I am trying to write a script to send an email via Mail of which the body of the message is from a dialogue box. I decided upon using Automator and AppleScript. I have, so far, the following workflow:
1. Run Apple Script:
set mypass to text returned of (display dialog "What are you doing?" with icon 1 buttons {"Tweet", "Cancel"} default button "Tweet" default answer "")
2. New Mail Message.
3. Send Outgoing Messages.
4. Run Apple Script:
on run {input, parameters}
tell application "System Events" to set visible of process "Mail" to false
return input
end run
I wand this workflow to allow the user to input an answer and this answer to be in the message field of the email. I can use the "Ask for Text" action in Automator but it does not allow for any control over the appearance of the dialogue box. The first script returns the result "<whatever is typed>" (ie. "Test") in the Results field below the script box, as does the "Ask for Text" action but it does not insert it into the message. Does anyone know what is going wrong here?
I am relatively new to AppleScript which is why I am using Automator but would like any information on how this could be done entirely in AppleScript. My previous attempts at sending email using script was unsuccessful.
My aim is to save this as an Application with a proper icon.see my reply to your post in the snow leopard forum.
http://discussions.apple.com/thread.jspa?messageID=10318297� -
Need to send external email with attachment for workflow 20000075
Hello Everyone,
I am new to W/F, I Need to send external email with attachment for PO Release W/F 20000075. Currently Work item is being sent to SAP inbox of required user based on PO Release strategy configuration in SPRO. I tried to create Send mail step after PO release event but I am not sure how to arrive at Recipient type in send mail step(the mail should be sent to person in the release strategy). Everything looks fine all I need to do is to send external email with attachment instead of sending work item into SAP inbox.
Your help will be highly appreciated.
Thanks.You can use extended notifications to send an e-mail message with a link to the workitem. Search for extended notifications in SDN.
Regards,
Martin -
Please help in senplease help in smartform send external email send.
hii all,
pleaseeeeeeeee help in sending external email in smartform print program.
i need for RLB_INVOICE order confirmation to send thru email.
what to code in ZRLN_INVOICE . i copied RLB_INVOICE in zprog.
so what rthe changes i need to code in driver program?
pleaseeeeeeee help with sample coding..Here is the code to send the Smartform to mail as PDF attachment.
*& Report ZTEST_PDF_MAIL
REPORT ZTEST_PDF_MAIL.
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,
Work Area declarations
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
Variables declarations
V_FORM_NAME TYPE RS38L_FNAM,
V_LEN_IN LIKE SOOD-OBJLEN,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST'
IMPORTING
FM_NAME = V_FORM_NAME
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.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
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.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_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.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = '[email protected]'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_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.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_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.
regards,
srinivas -
I cant send an email via UTL_MAIL : ERROR NO 530
hi .. i want to send an email via UTL_MAIL package. I am using ORACLE XE 10g.
I am trying this code :
declare
i INTEGER;
BEGIN
UTL_MAIL.send('[email protected]','[email protected]',NULL,NULL,'DENEMEKONU','DENEMEMESAJ',NULL,NULL);
END;
then, i encounter this error:
ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first.....
I made settings of smtp mail with:
ALTER SYSTEM SET SMTP_OUT_SERVER='smtp.gmail.com';
But i am getting this error consistently.
How can i solve this problem, thanx.Hello Kadir,
any errors, NDRs, logs that you could provide? How do you know the messages are not getting trough to that address?
Regards,
Andreas -
I use FM SO_OBJECT_SEND to send external email in my Z program but the output always in attachment format, depend on the format i specified (pdf,htm,txt,xls). I want the output to be in standard email body. How to do it?
Hi,
Can you please send your code or check if you are passing att_cont parameter in your function module. I would suggest you to use SO_NEW_DOCUMENT_SEND_API1 function module to send mail.
Also find the code below for your reference.
REPORT z_test_email_sending.
DATA: t_reclist TYPE TABLE OF somlreci1,
wa_receiver LIKE LINE OF t_reclist,
objcont TYPE TABLE OF solisti1,
subject TYPE TABLE OF solisti1,
objline TYPE solisti1,
w_line_count TYPE i,
doc_chng TYPE sodocchgi1,
offset type i.
CONSTANTS c_sep TYPE c VALUE '|'.
DATA : BEGIN OF mail_line OCCURS 0,
sep0,
model_year(6),
sep1,
mf(4),
sep2,
type(5),
sep3,
variant(14),
sep4,
kitype(5),
sep5,
option(8),
sep6,
color(8),
sep7,
uph(11),
sep8,
struc_week(10),
sep9,
END OF mail_line.
*construct the message and the e-mail
wa_receiver-receiver = receivers mail id.
* Email Subject
doc_chng-obj_name = 'test mail'.
MOVE 'Cost Error from SAP' TO doc_chng-obj_descr.
doc_chng-obj_langu = sy-langu.
* doc_chng-SENSITIVTY = 'P'.
* Email body
CLEAR objline.
CONCATENATE 'This is an automatically generated email'
'Please do not reply to this email.'
INTO objline SEPARATED BY space.
APPEND objline TO objcont.
CLEAR objline.
APPEND objline TO objcont.
CONCATENATE 'Cost errors in SAP as on' sy-datum INTO
objline SEPARATED BY space.
APPEND objline TO objcont.
CLEAR objline.
CLEAR objline.
APPEND objline TO objcont.
* horizontal line at beginning of records
DO 80 TIMES.
IF sy-index = 1.
* objline+sy-index(1) = ' '.
continue.
ELSE.
offset = sy-index - 1.
objline+offset(1) = '-'.
ENDIF.
ENDDO.
clear offset.
APPEND objline TO objcont.
CLEAR objline.
mail_line-sep0 = c_sep.
mail_line-model_year = 'Model Yr'.
mail_line-sep1 = c_sep.
mail_line-mf = 'Mf'.
mail_line-sep2 = c_sep.
mail_line-type = 'Type'.
mail_line-sep3 = c_sep.
mail_line-variant = 'Variant'.
mail_line-sep4 = c_sep.
mail_line-kitype = 'Ki-type'.
mail_line-sep5 = c_sep.
mail_line-option = 'Option'.
mail_line-sep6 = c_sep.
mail_line-color = 'Color'.
mail_line-sep7 = c_sep.
mail_line-uph = 'Upholstery'.
mail_line-sep8 = c_sep.
mail_line-struc_week = 'Str_week'.
mail_line-sep9 = c_sep.
MOVE mail_line TO objline.
APPEND objline TO objcont.
CLEAR mail_line.
CLEAR objline.
* horizontal line at beginning of records
*horizontal line at beginning of records
DO 80 TIMES.
IF sy-index = 1.
* objline+sy-index(1) = ' '.
continue.
ELSE.
offset = sy-index - 1.
objline+offset(1) = '-'.
ENDIF.
ENDDO.
clear offset.
APPEND objline TO objcont.CLEAR objline.
DO 5 TIMES.
mail_line-sep0 = c_sep.
mail_line-model_year = 'xxxx'.
mail_line-sep1 = c_sep.
mail_line-mf = 'xxx'.
mail_line-sep2 = c_sep.
mail_line-type = 'xxx'.
mail_line-sep3 = c_sep.
mail_line-variant = 'xxxx xxxxx'.
mail_line-sep4 = c_sep.
mail_line-kitype = 'xxx'.
mail_line-sep5 = c_sep.
mail_line-option = 'xxxxxx'.
mail_line-sep6 = c_sep.
mail_line-color = 'xxxxxx'.
mail_line-sep7 = c_sep.
mail_line-uph = 'xxxxxx'.
mail_line-sep8 = c_sep.
mail_line-struc_week = 'xxxxxx'.
mail_line-sep9 = c_sep.
MOVE mail_line TO objline.
APPEND objline TO objcont.
ENDDO.
CLEAR objline.
*horizontal line at beginning of records
DO 80 TIMES.
IF sy-index = 1.
* objline+sy-index(1) = ' '.
continue.
ELSE.
offset = sy-index - 1.
objline+offset(1) = '-'.
ENDIF.
ENDDO.
clear offset.
APPEND objline TO objcont.
CLEAR objline.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver TO t_reclist.
* size
DESCRIBE TABLE objcont LINES w_line_count.
READ TABLE objcont INDEX w_line_count INTO objline.
doc_chng-doc_size = ( w_line_count - 1 ) * 255 +
STRLEN( objline ).
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_chng
document_type = 'RAW'
* put_in_outbox = ' '
commit_work = 'X'
TABLES
* object_header = subject
object_content = objcont
receivers = t_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
KR Jaideep, -
Disallow sending External email
Hi, how to configure Exchange 2013 to disallow certain users to send external email
Hi,
As what DareDevil57 mentioned above, we can create a transport rule to meet this requirement.
Here is an article about transport rule for your reference.
Transport Rules:
http://social.technet.microsoft.com/Forums/en-US/dedce6eb-f4b9-42be-b732-dba691b6c284/disallow-sending-external-email?forum=exchangesvradmin
Hope this helps.
Best regards,
Belinda
Belinda Ma
TechNet Community Support -
Convert ABAP Report to HTML & Send External Email Attachment
Hi,
I have a requirement described as below. A report is scheduled to run in the background creates a spool, to be converted to HTML format and send to Third Parties (External Email ID's) via Email. Please let me know whether the requirement is not clear. Can you please suggest me a suitable SAP Solution for this requirement?
Thanks,
Kannan.SAHi,
See below simple report to convert the internal table data to a HTML format data and stores in a internal table and then pass that internal table as an attachment to the external email using function module SO_NEW_DOCUMENT_ATT_SEND_API1.
You need for create a spool also.
REPORT Z_HTML .
include <icon>.
types: begin of msg,
type like icon-id,
text(140) type c,
end of msg.
constants: gc_marked type c value 'X',
gc_ok like icon-id value '@5B@'.
data:
gt_msg type standard table of msg,
gs_msg like line of gt_msg,
gv_msg(138) type c,
*-- html
html_container type ref to cl_gui_custom_container,
html_control type ref to cl_gui_html_viewer,
my_row_header like w3head occurs 10 with header line,
my_fields like w3fields occurs 10 with header line,
my_header like w3head,
my_html type standard table of w3html ,
ok_code like sy-ucomm.
Start of Selection *
start-of-selection.
clear gv_msg.
gv_msg = 'MESSAGES for HTML'.
do 3 times.
perform message using gc_ok gv_msg .
enddo.
End of Selection *
end-of-selection.
set screen 0100.
*& Form message
form message using p_type
p_text.
clear gs_msg.
gs_msg-type = p_type.
gs_msg-text = p_text.
append gs_msg to gt_msg.
endform. " MESSAGE
*& Module STATUS_0100 OUTPUT
module status_0100 output.
perform convert_itab_html.
set titlebar '100' .
set pf-status 'MAIN100'.
create object html_container
exporting
container_name = 'CONTAINER'.
create object html_control
exporting
parent = html_container
saphtmlp = gc_marked .
data: assigned_url type url.
call method html_control->load_data
EXPORTING
URL = url
TYPE = 'text'
SUBTYPE = 'html'
SIZE = 0
ENCODING =
CHARSET =
importing
assigned_url = assigned_url
changing
data_table = my_html
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_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.
call method html_control->show_url
exporting
url = assigned_url
FRAME =
IN_PLACE = ' X'
EXCEPTIONS
CNTL_ERROR = 1
CNHT_ERROR_NOT_ALLOWED = 2
CNHT_ERROR_PARAMETER = 3
DP_ERROR_GENERAL = 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.
endmodule. " STATUS_0100 OUTPUT
*& Module exit INPUT
module exit input.
leave program.
endmodule. " exit INPUT
*& Module user_command_0100 INPUT
text
module user_command_0100 input.
case ok_code.
when 'EXIT' or 'BACK'.
leave program.
when others.
call method cl_gui_cfw=>dispatch.
endcase.
endmodule. " user_command_0100 INPUT
*& Form convert_itab_html
form convert_itab_html.
data: lv_tabix like sy-tabix.
*-- table header
call function 'WWW_ITAB_TO_HTML_HEADERS'
exporting
field_nr = 1
text = 'Type'
fgcolor = 'navy'
bgcolor = 'red'
font = 'Arial'
tables
header = my_row_header.
call function 'WWW_ITAB_TO_HTML_HEADERS'
exporting
field_nr = 2
text = 'Message'
fgcolor = 'navy'
bgcolor = 'red'
font = 'Arial'
tables
header = my_row_header.
*-- table rows
clear lv_tabix.
loop at gt_msg into gs_msg.
lv_tabix = sy-tabix.
call function 'WWW_ITAB_TO_HTML_LAYOUT'
exporting
field_nr = 1
line_nr = lv_tabix
icon = gc_marked
tables
fields = my_fields.
call function 'WWW_ITAB_TO_HTML_LAYOUT'
exporting
field_nr = 2
line_nr = lv_tabix
fgcolor = 'red'
bgcolor = 'black'
font = 'Arial'
size = '2'
tables
fields = my_fields.
endloop.
*-- header
move 'Messages during program run' to my_header-text.
move 'Arial' to my_header-font.
move '2' to my_header-size.
move 'Centered' to my_header-just.
move 'red' to my_header-bg_color.
move 'blue' to my_header-fg_color.
refresh my_html.
call function 'WWW_ITAB_TO_HTML'
exporting
table_header = my_header
all_fields = ' '
tables
html = my_html
fields = my_fields
row_header = my_row_header
itable = gt_msg.
endform. "convert_itab_html -
UCCX Send eMail unable to send external emails
Hi,
I created a script where it asks the user to record a prompt and then it sends that prompt as an attachment via email. I am able to get it to send the email internally on our domain, however unable to send the email externally. I did a Reactive Script debug and there are no error messages. I tried searching through the MIVR logs but cannot find anything, or don't know what to look for. Any insight? We are running UCCX 8.5 Premium. Are there any tests I can do through the CLI to test port connectivity to Exchange? It's very odd that it's able to send the email internally.
Thank you.If its getting to Exchange and you are able to send emails internally but not externally, i think its an exchange issue. Maybe its because the From address is not assigned in Exchange and Exchange or your spam filter might not allow to send emails out.
-
How to send external email of a Purchase Order
Hello,
I have to send an external email (pdf attachment) of a Purchase Order.
I use the standard sap program: /SMB40/FM06P and the smartform: /SMB40/MMPO_L.
Within transaction NACE I used the following entries:
Medium: 5 (External Send), Program: /SMB40/FM06P, Form routine: ENTRY NEU and Smartform: /SMB40/MMPO_L.
After running transaction ME22n (messages: External Send) I got the following error-messages in processing log:
- Please maintain an output device in your user master data.
- Archiving format not equal to PDF.
Please, can someone help me to solve this problem.
Regards,
Rajeshhi
U need to write the code to convert the smartform to PDF using FM Convert_otf and also for sending mail
The standard program has to be copied to Z and write ur code..to perform u requirements
Check the below links
SO_NEW_DOCUMENT_ATT_SEND_API1
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8cd6adbb-0301-0010-39ba-938c601d5db9
Email Invoices to customer as a PDF attachment
surya -
Hi All
My requirement is to send an email (Lets say, to my gmail ID).
I have tried FMs SO_DOCUMENT_SEND_API1 and SO_OBJECT_SEND.
In FM SO_DOCUMENT_SEND_API1 , email is only reaching till SCOT/SOST and not moving further. The only way that the mail can be sent is through the Standard Report rsconn01. Again when I use SUBMIT RSCONN01, all the mails pending in SOST are released and sent to the respective ids. What I want here is only the email which has been sent from my ID should be released from sapconnect.
In FM SO_OBJECT_SEND, no error is being reported (sy-subrc EQ 0) but there is no trace of this email, anywhere.
This is the sample of data i m passing to FM so_object_send
DATA: hd_change LIKE sood1.
DATA: receivers LIKE soos1 OCCURS 0 WITH HEADER LINE.
DATA: emailbody LIKE soli OCCURS 0 WITH HEADER LINE.
hd_change-objla = 'EN'.
hd_change-objdes = 'Errors'.
hd_change-objsns = 'F'.
receivers-recesc = 'U'.
receivers-recextnam = 'Mygmailid'.
receivers-sndart = 'INT'.
APPEND receivers.
Create the error message
APPEND 'This is test message' TO emailbody.
APPEND 'This is test message' TO emailbody.
APPEND 'This is test message' TO emailbody.
APPEND 'This is test message' TO emailbody.
APPEND 'This is test message' TO emailbody.
APPEND 'This is test message' TO emailbody.
APPEND 'This is test message' TO emailbody.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = hd_change
object_type = 'RAW'
outbox_flag = 'X'
owner = sy-uname
TABLES
objcont = emailbody[]
receivers = receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
OTHERS = 22.
Can you kindly help me sending the email.Hello,
At the end of teh program just give:
SUBMIT RSCONN01 WITH MODE EQ 'INT' AND RETURN.
This willl only send the emails i.e mode is internet users.
Regards,
Neeraj -
Send external email when work item is triggered
Hello,
i have implemented the standard sap workflow for release of purchase requistions.
I would like to introduce a functionality that for the approver with the high spending authorities e.g. the user which are rarely in SAP because it is the CxOs will receive automatically a notification via Lotus notes email system.
What do I have to do in order:
to create and send an email from SAP to Lotus Notes
to only send an email to some approvers (I would like to avoid sending everybody an email, otherwise low level approvers get spammed with approval emails).
Thank you very much for your support.Hello,
If you want to just send an email notifying them of workitems, then depending on your version you would use RSWUWFML2 or Extended Notifications.
If you want them to be able to action the PRs then I think that's possible from Lotus Notes, try searching this forum.
regards
Rick Bakker
Hanabi Technology
Maybe you are looking for
-
WHERE COULD BE THE ERROR ?
Hello, I made a project using VisualAge for Java 3.5 and the I export to a directory. The problem is that if I run the application outside VisualAge, on another pc where I install JVM, Centura Database and JDBC I receive an error message that tell me
-
Where is the Call to the Remote Header Portlet
I am running into some issues and will really appreciate if any one can provide some information about the issue. We have a portlet ready navigation in our portal (6.1 MP1) and we have a custom header portlet ( Remote portlet , sitting on our portlet
-
Hi, How can I hide column in JTable. (without standart remove method using) Thanks.
-
Do we need License...
Hello All, If we migrate our application to web and we but the forms and reports server license, Do we still need the oracle application server (fusion middleware) license? My sales rep say we don't, but I'm in doubt, can any one help. Best Regards,
-
To extract data from t.code mm02
Hi, I want to write the program to extract the data from t.code mm02 for clsiification and unit of measure . In classification there are charactersitcs and values which i want to extract. And in unit of measure i want to extract the data . pl