Fm to mail .txt attachment
Hi.
I need a FM to mail .txt attachment .Pls let me know with code.
Kind regards,
sami.
Hi
Refer This link
Urgent - Sending mail with .txt attachment
Ranga
Similar Messages
-
Convert Script output data to Text(.txt) file & send mail with attachment.
Hi All,
Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
Plese sugget with Function modules to cover as Text file.
I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
Thanks in advance.Hi, Thanks for responst.
We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
Thanks. -
E-mail body getting converted to .txt attachment
Hello All,
Below is the description of the issue: -
1) Smartform is sent as .pdf attachment in the mail along with some text in the email body, using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
2) Initially, the entire process was working fine.
3) However recently, there is a problem while sending the email. Whenever we are sending the email, the text in the email body is automatically converted into .txt attachment rather than being sent in email body.
4) There are no code changes which are done, have verified that.
5) I copy pasted the same code, in another system and the email is sent correctly with email body.
So wanted to know the following :-
1) So is the conversion of email to .txt file due to some script running on the server / is this due to some configuration.
2) If it is due to some configuration, then where is this configuration maintiained ?
3) Anything which can be done on the ABAP side to control this ?
Regards,
Rinkesh DoshiHello All,
I have identified the root cause of this problem.
The issue is due to the configuration maintained in transaction SODIS, which is the transaction to add disclosures to the outgoing emails.
If the standard disclosure is activated over here, the original email body is sent as text attachment and the standard disclosure is added in the email body. If we deactivate this disclosure functionality, the process works perfectly fine.
(This logic is included inside the class CL_SEND_REQUEST_BCS, method ADD_DISCLOSURE_TO_MIME).
So is this standard functionality error ? I could not find SAP notes which are relevant in above context.
Regards,
Rinkesh Doshi -
Mail is sending the body of my email as a .txt attachment
I have a serious problem when I send out an ordinary email, with no attachment. The first line appears as it should.."Dear whoever", and after that the email is blank. This makes me look rather stupid, but if the recipient checks the .txt attachment, they understand my message because the body of text has been punted into an attachment for some reason. I've had this feedback from several people. I use multiple email accounts in mail and I've had the same feedback for different accounts on separate domains. The message appears correct in my sent items, so I have absolutely no way of know that this has happened until the recipient tells me. It seems to be intermittent or not happening in every case.
I would be so pleased if anyone could help me out with this one?Greetings,
Mail doesn't create .txt files from email messages; it sends exactly what you type. If some of your recipients are claiming they receive .txt files, that would most likely be due to their email client, which no doubt is running Windoze. Only they can solve that problem. If the message is okay in your Sent mailbox, that's exactly what you sent, so the problem is on their end. -
Problems with txt attachment in the mail
Hi,
I noticed a big problem for the mail in mac os x. Every time I received my txt format data file in attachment with email, it automatically displayed at the end of my email in the Mail instead of remaining as a txt attachment file ready for download. How can I set it to stay as an attachment instead of being forced to show up as plain text in the end of my received email? Thanks.Hi,
I noticed a big problem for the mail in mac os x. Every time I received my txt format data file in attachment with email, it automatically displayed at the end of my email in the Mail instead of remaining as a txt attachment file ready for download. How can I set it to stay as an attachment instead of being forced to show up as plain text in the end of my received email? Thanks. -
HAving issues in sending txt attachment in abap email pgm
Hi,
I need to send an email from my Abap program with a txt attachment in the flowing format:
We are glad to see these results
Kindly forward the details Number
Vendor details:123
However, this is not getting formatted properly and the txt file is getting unnessacary spaces. I am working in ECC 6 and is Unicode complaint.
I am not able to format this in the txt attachment.
I am providing the sample code as below.Please kindly help me.Thanks!
Creation of the document to be sent File Name
maildata-obj_name = 'Payee extraction data'. "EC NOTEXT
Mail Subject
maildata-obj_descr = 'Payee Positive pay'. "EC NOTEXT
Mail Contents
loop at lt_file into l_file.
mailtxt-line = l_file.
xtex1-line = l_file.
append xtex1.
append mailtxt.
endloop.
clear: mailpack, mailbin, mailhead.
refresh: mailpack, mailbin, mailhead.
describe table mailtxt lines tab_lines.
read table mailtxt index tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).
Creation of the entry for the compressed document
clear mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
append mailpack.
mailhead = 'PayeePositivepay.txt'.
append mailhead.
Mail Contents
loop at lt_file into l_file.
mailbin-line = l_file.
append mailbin.
endloop.
break-point.
describe table mailbin lines tab_lines.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'txt'.
mailpack-obj_name = 'payee'.
mailpack-obj_descr = 'Subject'. "EC NOTEXT
mailpack-doc_size = tab_lines * 140.
append mailpack.
Get the neccessary email ids from the table
SELECT * FROM ZFI_EMAILIDS INTO table I_ZFI_EMAILIDS.
LOOP AT I_ZFI_emailids.
mailrec-receiver = i_zfi_emailids-zemailid .
mailrec-rec_type = 'U'.
mailrec-com_type = 'INT'.
mailrec-notif_del = 'X'.
mailrec-notif_ndel = 'X'.
mailrec-express = 'X'.
append mailrec.
endloop.
Sending the document
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin[]
contents_txt = mailtxt
CONTENTS_HEX = xtex
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
endform. "send_emailHi,
You need to use attribute CL_ABAP_CHAR_UTILITIES=> NEWLINE or CR to use format the mail contents. -
Sending Mail with attachment and preserving the order of attachment
Hi Everyone!!!!!!
My requirement is to send Email with attachment in the same order as they were attached by Sender while composing the mail. I want to preserve order of attachment in the mail and when receiver open a mail, the attached files should be reflected in same order as it was on sender side. In my application,the documents being upload are already in my database. So, user just requires to mark the corresponding check box and enter the Sequence number for each attachment. When he clicks on "SEND" button, the Source file is first written from database to OS level and then files are attached from source available on OS . The attached file name could be anything. Based on the Sequence number file should be attached and send. My current code works fine,but problem it is that the Sequence number is not preserved in my attachment . However, when I traced the output of FOR Loop by inserting it in a table " temp_trace" I found that the Sequence is preserved in the order that I want. So, I think that uploaded files are written on the Operating system in same order but they are not attached in same order. Below is the sample code that is I am using to attach file in email. Here, the user_sequence is the sequence number entered by user.
for i in (select case when user_sequence is not null
then trim(to_char(user_sequence ,'09'))||'_'||file_name||'.pdf'
else ||'_'||file_name||'.pdf' end file_name ,
file_src,length(file_src) len,cd.doc_id,PRIORITY from
MIM_CLIENT_DOCS CD,(select DOC_ID ,user_sequence from table P_DOC_AND_user_sequence ) TEMP_TAB
WHERE CD.DOC_ID = TEMP_TAB.DOC_ID order by case when user_sequence is null then 1 else 0 end, file_name)
loop
insert into temp_trace values(i.file_name);
L_OUT := UTL_FILE.FOPEN(v_oracle_dir,i.file_name,'wb',32760);
end loop;
I want my output as
1_first attachment.txt
2_second_attachment.docx
3_abc.sql
_xxx.txt ------------------ When sequence is not assigned by user That is null at last.
Unfortunately, I am not getting attachment in mail in this sequence. Can anyone give me suggestion.
Sorry for stuff essay and thanks in advance!!!!!!!!!!!>
Please update your forum profile with a real handle instead of "974850".
My requirement is to send Email with attachment in the same order as they were attached by Sender while composing the mail. I want to preserve order of attachment in the mail and when receiver open a mail, the attached files should be reflected in same order as it was on sender side. In my application,the documents being upload are already in my database. So, user just requires to mark the corresponding check box and enter the Sequence number for each attachment. When he clicks on "SEND" button, the Source file is first written from database to OS level and then files are attached from source available on OS . The attached file name could be anything. Based on the Sequence number file should be attached and send. My current code works fine,but problem it is that the Sequence number is not preserved in my attachment . However, when I traced the output of FOR Loop by inserting it in a table " temp_trace" I found that the Sequence is preserved in the order that I want. So, I think that uploaded files are written on the Operating system in same order but they are not attached in same order. Below is the sample code that is I am using to attach file in email. Here, the user_sequence is the sequence number entered by user.Always post code using <tt>\...\</tt> tags as described in the FAQ.
for i in (select case when user_sequence is not null
then trim(to_char(user_sequence ,'09'))||'_'||file_name||'.pdf'
else ||'_'||file_name||'.pdf' end file_name ,
file_src,length(file_src) len,cd.doc_id,PRIORITY from
MIM_CLIENT_DOCS CD,(select DOC_ID ,user_sequence from table P_DOC_AND_user_sequence ) TEMP_TAB
WHERE CD.DOC_ID = TEMP_TAB.DOC_ID order by case when user_sequence is null then 1 else 0 end, file_name)
loop
insert into temp_trace values(i.file_name);
L_OUT := UTL_FILE.FOPEN(v_oracle_dir,i.file_name,'wb',32760);
end loop;I want my output as
1_first attachment.txt
2_second_attachment.docx
3_abc.sql
_xxx.txt ------------------ When sequence is not assigned by user That is null at last.
Unfortunately, I am not getting attachment in mail in this sequence. Can anyone give me suggestion.I see no code that attaches anything to email messages. What code is used to do this? Why are the files being written to the file system? -
Mail_Receiver: Send Mail with attachment
Hi everybody,
I need some help. I want to send a mail with attachment.
for this I have imported SAPs xsd for the mail adapter.
I wonder how to map the target fields?
The following causes five! attachments in SXMB_MONI and the adapter throws
java.lang.IllegalArgumentException: can't parse argument number
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
<Subject>SubjctName</Subject>
<From>mailadress</From>
<To>mailadress</To>
<Content_Type>text/plain; charset="ISO-8859-1"</Content_Type>
<Content_Description>
<attachment filename="filename.txt">This should be the content of the attachment</attachment>
</Content_Description>
<Content>Constant</Content>
</ns1:Mail>
</ns0:Message1>
</ns0:Messages>
How do I have to foll the target fields?
Thanks regards
MarioHi
the following links may help you :
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken]
http://help.sap.com/saphelp_nw04/helpdata/en/3c/b4a6490a08cd41a8c91759c3d2f401/content.htm
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
Also reffer to the below mentioned thread;
Regarding mail sent with an excel attachment
Regard's
Chetan Ahuja -
Content in .txt attachment
Hello Everyone,
I need to send some internal table data to the user decision as an attachment in TEXT format(.TXT). The attachment should consist of header, body (itab data in tab format) and a footer.
Presently i am able to send the mail with attachment, but the data in the notepad is not coming in a correct format.The data has been messed up and randomly distributed....Could any one suggest me how to convert internal table data to text file format..
Can anybody refer me some sample examples of it...
Thanks in advance,
SangeetaReport ZFILE_APPSERVER is used to upload the file & to trigger the workflow. BO "ZFS1" is the customized business.
Method "attachdoc" is created for attachment to workitem.
REPORT ZFILE_APPSERVER.
*INCLUDE <CNTAIN>.
INCLUDE <CNTN01>.
DATA: BEGIN OF l_filedata OCCURS 0,
text(200) TYPE c,
END OF l_filedata.
DATA: BEGIN OF l_readdata OCCURS 0,
text(200) TYPE c,
END OF l_readdata.
DATA: L_READDATA1 TYPE ZFILE_DATA1 with header line.
DATA: BEGIN OF l_read_bin OCCURS 0,
buffer type xstring,
END OF l_read_bin.
DATA: LENG TYPE I,
ZVAR1 TYPE I VALUE 0.
DATA: v_filepath type rlgrap-filename VALUE '/usr/iffsap/data/test/workflow/new.txt'.
DATA myref TYPE REF TO CX_SY_FILE_OPEN_MODE.
DATA err_text TYPE string.
DATA: OBJECT TYPE swc_object,
OBJKEY TYPE SWR_STRUCT-OBJECT_KEY,
IT_AGENTS TYPE SWHACTOR OCCURS 0,
GV_INITIATOR LIKE SWWWIHEAD-WI_CREATOR.
SWC_CONTAINER CONTAINER. "Declaration
SWC_CREATE_CONTAINER CONTAINER. "Initialization
SWC_CREATE_OBJECT OBJECT 'ZFBS1' 'ZUNAME'.
DATA: BEGIN OF CONTAINER OCCURS 0.
INCLUDE STRUCTURE SWCONT.
DATA: END OF CONTAINER.
SELECT-OPTIONS / PARAMETERS *
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename
DEFAULT 'd:\data'.
SELECTION-SCREEN END OF BLOCK blk1.
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.
START-OF-SELECTION.
Perform file_upload.
try.
OPEN DATASET V_FILEPATH FOR output IN TEXT MODE ENCODING DEFAULT.
CATCH cx_sy_file_open_mode INTO myref.
err_text = myref->get_text( ).
ENDTRY.
if sy-subrc = 0.
Loop at l_filedata.
TRANSFER L_FILEDATA TO V_FILEPATH.
endloop.
endif.
CLOSE DATASET V_FILEPATH.
if sy-subrc = 0.
write: 'File uploaded successfully'.
endif.
OPEN DATASET V_FILEPATH FOR INPUT IN TEXT MODE ENCODING DEFAULT.
*OPEN DATASET V_FILEPATH FOR INPUT IN BINARY MODE.
DO.
READ DATASET V_FILEPATH INTO l_readdata LENGTH LENG.
append l_readdata.
ZVAR1 = ZVAR1 + LENG.
WRITE: ZVAR1.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET V_FILEPATH.
IF SY-SUBRC = 0 AND NOT L_READDATA[] IS INITIAL.
SWC_SET_TABLE CONTAINER 'L_READDATA' L_READDATA.
SWC_SET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
SWC_SET_ELEMENT CONTAINER 'ZFBS1' OBJECT.
GV_INITIATOR = SY-UNAME.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
CREATOR = GV_INITIATOR
PRIORITY = SWFCO_NO_PRIO
TASK = 'WS90600147'
CALLED_IN_BACKGROUND = 'X'
DEADLINE_DATA = ' '
NO_DEADLINE_PARAMETERS = ' '
IMPORTING
WI_ID =
WI_HEADER =
RETURN =
WI_RESULT =
SWF_RETURN =
TABLES
AGENTS = IT_AGENTS
DEADLINE_AGENTS =
DESIRED_END_AGENTS =
LATEST_START_AGENTS =
EXCLUDED_AGENTS =
NOTIFICATION_AGENTS =
SECONDARY_METHODS =
WI_CONTAINER = CONTAINER.
CHANGING
WI_CONTAINER_HANDLE =
EXCEPTIONS
ID_NOT_CREATED = 1
READ_FAILED = 2
IMMEDIATE_START_NOT_POSSIBLE = 3
EXECUTION_FAILED = 4
INVALID_STATUS = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK.
ENDIF.
FORM file_upload .
DATA: l_filename TYPE string.
l_filename := p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
has_field_separator = ' '
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = l_filedata.
EXCEPTIONS
ENDFORM. " file_upload
BEGIN_METHOD ATTACHDOC CHANGING CONTAINER.
DATA: L_READDATA TYPE ZFILE_DATA1 with header line,
ZSWR_ATT_ID LIKE SWR_ATT_ID,
ZSWR_ATT_HEADER TYPE SWR_ATT_HEADER,
WORKITEMID LIKE SWR_STRUCT-WORKITEMID,
ZXSTRING TYPE XSTRING,
ZSTRING TYPE STRING,
ZVAR1 TYPE I,
ZLEN TYPE I,
SOFM TYPE SWC_OBJECT.
SWC_GET_TABLE CONTAINER 'L_READDATA' L_READDATA[].
SWC_GET_ELEMENT CONTAINER 'WORKITEMID' WORKITEMID.
SWC_GET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
INPUT_LENGTH = 9000
FIRST_LINE = 0
LAST_LINE = 6
MIMETYPE = ' '
ENCODING =
IMPORTING
TEXT_BUFFER = ZSTRING
OUTPUT_LENGTH =
TABLES
BINARY_TAB = l_readdata
EXCEPTIONS
FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBE
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
ENDIF.
TO FILL THE HEARDER CONTENTS
ZSWR_ATT_HEADER-FILE_TYPE = 'T'.
ZSWR_ATT_HEADER-FILE_NAME = 'ACCRUAL'.
ZSWR_ATT_HEADER-FILE_EXTENSION = 'EXC'.
ZSWR_ATT_HEADER-LANGUAGE = 'EN'.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
WORKITEM_ID = WORKITEMID
ATT_HEADER = ZSWR_ATT_HEADER
ATT_TXT = ZSTRING
ATT_BIN = ZXSTRING
DOCUMENT_OWNER = SY-UNAME
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
IMPORTING
RETURN_CODE =
ATT_ID = ZSWR_ATT_ID
TABLES
MESSAGE_LINES =
MESSAGE_STRUCT =
SWC_SET_ELEMENT CONTAINER 'ZSWR_ATT_ID' ZSWR_ATT_ID.
SWC_SET_ELEMENT CONTAINER 'SOFM' ZSWR_ATT_ID-DOC_ID.
END_METHOD.
Thanks & Regards,
Sangeeta
Edited by: sangeeta tahiliani on Dec 1, 2009 1:27 PM -
Content coming as .txt attachment along with email but not in email body
Hi,
I have a proxy to email scenario. The requirement is to generate an excel sheet and keep it as an attachment and send it to user through email.
I am able to get the excel sheet as an attachment in email but the content of email is also coming as attachment which I do not want.
Problem area :
============================================
The Content should come in Email body but it is coming as .txt attachment in email. The email body is blank.
Can someone help as how I can get the content in email body.?
/Regds
AzaharHi Azahar,
May you can find the solution in the "
Adapter-Specific Message Attributes
Configuring the Receiver Mail Adapter (SAP Library - Partner Connectivity Kit) -
Script for forward mail as attachment
Hi,
I think there is no direct call for creating forward mail as attachment. I tried "forward" reply and other things.Its working fine.
Please let me know if any one have idea for creating script for apple mail "forward as attachment".hm... perhaps these two functions do what you wanna do :-/
on createmail_emlx_files_attachment_ofselection()
tell application "Mail"
-- get the mail selection
set myMessages to selection
--do it to every selected mail
repeat with m in myMessages
--get the folder where the emlx file is stored in
set mypath to quoted form of POSIX path of ((account directory of account of mailbox of m) as alias)
--get the id of that message (should be unique within each account)
set myid to id of m
--find the folder where this unique email (by id) is stored in
set myfolder to quoted form of (paragraph 1 of (do shell script "find " & mypath & " -name '" & myid & ".emlx' -exec dirname {} \\;"))
--create a compressed tar archive of this message and open this gzipped files with Apple Mail (-> attach it to a new message).
do shell script "cd " & myfolder & ";tar -rf " & myid & ".tar " & myid & ".emlx;gzip " & myid & ".tar;mv " & myid & ".tar.gz /tmp/;open -a /Applications/Mail.app /tmp/" & myid & ".tar.gz"
end repeat
end tell
end createmail_emlx_files_attachment_ofselection
on createmail_source_attachment_ofselection()
tell application "Mail"
-- get the mail selection
set myMessages to selection
--do it to every selected mail
repeat with m in myMessages
set myid to id of m
set mysource to quoted form of ((source of m) as text)
do shell script "cd /tmp/;echo " & mysource & "|cat>/tmp/" & myid & ".txt;gzip " & myid & ".txt;open -a /Applications/Mail.app " & myid & ".txt.gz"
end repeat
end tell
end createmail_source_attachment_ofselection -
Mail Receiver: Attachment gets not generated
Hi,
AFAIK in SXMB_MONI in the MappingStep the attachment is shown, when it was created.
My mapping does not show the attachment.
Although my mapping is identical to former XIs where I implementes "Mail with attachment"
We are now on NW04S_16_REL. Does anybody had the same problems?
My field are filled as follows:
/ns0:Mail/Subject = "BlaBla"
/ns0:Mail/From = "xyz@xyz"
/ns0:Mail/To = "xyz@xyz"
/ns0:Mail/Content_Type = Constant: multipart/mixed; boundary="AaBb--984dfgeSSd3532"
/ns0:Mail/Content_Disposition = Constant: attachment
/ns0:Mail/Content =
<Content>--AaBb--984dfgeSSd3532
Content-Type: text/plain; charset="UTF-8"
some Text
--AaBb--984dfgeSSd3532
Content-Type: text/plain;charset="UTF-8";name=attachment.txt
--AaBb--984dfgeSSd3532
ThisSouldbeTheTextInTheAttachment</Content>
Why does the attachment not be generated?
Thanks, Regards
MarioNo,
but consider:
Befor the message enters the CC the attachment should already be seen in SXMB_MONI
Regards
Mario
Edited by: Mario Müller on Apr 20, 2009 4:05 AM -
My local health centre sends me regular dosage instructions for medication I have to take. They send an email with a .txt attachment.
I can view this easily if I open the mail on my iPad. I can view it if I access my ISP's webmail interface. But if I open it through MacMail - IMAP connection (my preferred email channel) the attachment is unreadable. The .txt file opens but presents a gobbledygook of alpha and numeric characters.
Is it something in my settings I've missed? Have been puzzling for weeks without being able to find an answer...Screenshots
This is the email on my ipad...
and this is what the attachment looks like when I click and open it (have edited out some personal info)
The same email in Mac Mail (OSX 10.10.1) =
And the attachment looks like this when opened (txt editor or word or anything...)
Any ideas welcomed -
Problem in sending mail with attachment
Hi All,
I am using the function module <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b> to send mail with attachment.
the program executes properly and shows a message <b>'Document Sent'</b>. But neither the sent mail appears in <b>'SOST'</b> nor I get it on the specified email id.
Below is my code:
<b>***</b> As attachment I am sending resume whose contents are stored in table 'ZResume' corresponding to personnel no.(pernr) and serial No.(srno).
<b>START OF PROGRAM</b>----
REPORT ZPTEST_SEND_MAIL_ATTATCHMENT.
DATA : w_name TYPE sos04-l_adr_name.
DATA: RESUME TYPE table of XSTRING with header line.
START-OF-SELECTION.
<b>* Data Declaration</b>
DATA:
l_datum(10),
ls_docdata TYPE sodocchgi1,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
WRITE sy-datum TO l_datum.
SELECT SINGLE RESUME FROM ZRESUME INTO RESUME
WHERE PERNR EQ '00001182'
AND SRNO EQ '1'.
APPEND RESUME.
<b>* Because RESUME may be of size RAW(1000)
and objbin is of size CHAR(255) we make this table copy</b>
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = resume
out = lt_objbin
EXCEPTIONS
compress_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
<b>* Create the message and send the document.
Create Message Body</b>
<b>* Title and Description</b>
ls_docdata-obj_name = 'Resume'.
ls_docdata-obj_descr = 'Resume'.
<b>* Main Text</b>
lt_objtxt = 'Resume of the candidate' .
APPEND lt_objtxt.
<b>* Write Packing List (Main)</b>
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
CLEAR lt_objpack-transf_bin.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
<b>* Create Message Attachment
Write Packing List (Attachment)</b>
l_att_type = 'ALI'.
DESCRIBE TABLE lt_objbin LINES l_tab_lines.
READ TABLE lt_objbin INDEX l_tab_lines.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = l_att_type.
lt_objpack-obj_name = 'ATTACHMENT'.
lt_objpack-obj_descr = 'Resume'.
APPEND lt_objpack.
<b>* Create receiver list</b>
lt_reclist-receiver = '[email protected]'.
lt_reclist-rec_type = 'U'.
APPEND lt_reclist.
<b>* Send Message</b>
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_docdata
put_in_outbox = ''
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_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.
Document sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
ELSE.
Document <&> could not be sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH ls_docdata-obj_name.
ENDIF.
<b>END OF PROGRAM</b>----
Can anybody tell me where I am making mistake?
Thanks in advance,
PragyaHi Pragya,
Refer the code below. It's working fine and try to match up the things from your program.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
*file_open_error = 1
*file_read_error = 2
*no_batch = 3
*gui_refuse_filetransfer = 4
*invalid_type = 5
*no_authority = 6
*unknown_error = 7
*bad_data_format = 8
*header_not_allowed = 9
*separator_not_allowed = 10
*header_too_long = 11
*unknown_dp_error = 12
*access_denied = 13
*dp_out_of_memory = 14
*disk_full = 15
*dp_timeout = 16
*OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
***INCLUDE ZINCLUDE_01 .
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
tables crmrfcpar.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
data v_rfcdest LIKE crmrfcpar-rfcdest.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
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
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
FORM
FORM ml_saveforbp USING jobname jobcount.
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*DATA : seqnr TYPE i.
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
FORM
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
ENDFORM. "ml_fetchfrombp
<b>Please reward points if it helps.</b>
Regards,
Amit Mishra -
Send Mail with Attachment to Outlook - Version 3.1i
Hi Every one,
I need to draft a logic in 3.1i system that sends a mail to Microsoft outlook inbox with attachments.
The below flow of logic is the core part of the code that I am using for mails without attachments.
OPEN DATASET P_FNAME FOR OUTPUT IN TEXT MODE.
IF P_FROM NE SPACE.
CONCATENATE 'From:'(MFR) P_FROM INTO P_FROM SEPARATED BY SPACE.
TRANSFER P_FROM TO P_FNAME.
ENDIF.
IF P_TO NE SPACE.
CONCATENATE 'To:'(MTO) P_TO INTO P_TO SEPARATED BY SPACE.
TRANSFER P_TO TO P_FNAME.
ENDIF.
IF P_CC NE SPACE.
CONCATENATE 'Cc:'(MCC) P_CC INTO P_CC SEPARATED BY SPACE.
TRANSFER P_CC TO P_FNAME.
ENDIF.
IF P_BCC NE SPACE.
CONCATENATE 'Bcc:'(MBC) P_BCC INTO P_BCC SEPARATED BY SPACE.
TRANSFER P_BCC TO P_FNAME.
ENDIF.
IF P_SUB NE SPACE.
CONCATENATE 'Subject:'(MSB) P_SUB INTO P_SUB SEPARATED BY SPACE.
TRANSFER P_SUB TO P_FNAME.
ENDIF.
LOOP AT S_BODY.
TRANSFER S_BODY-LOW TO P_FNAME.
ENDLOOP.
CLOSE DATASET P_FNAME.
Run External Command: SENDMAIL
CLEAR PARCOM.
REFRESH OUT_LINES.
concatenate 'sendmail -t < ' p_fname into parcom.
Execute Command
call 'system' id 'COMMAND' field PARCOM id 'TAB' field out_lines-SYS .
I have tried creating another file in AL11 and using it as attachment after the transfer of subject text in the above code, like -
CONCATENATE 'Attach:'(MAT) '/usr/sap/GS1/DVEBMGS20/work/attach.txt INTO P_ATTACH SEPARATED BY SPACE.
TRANSFER P_ATTACH TO P_FNAME.
But, this did not work.
Need your help in extending the code to send attachments.
Thanks in Advance,
Regards
Govardhan
Edited by: Gova12 on Sep 8, 2009 12:25 PM
Edited by: Gova12 on Sep 8, 2009 12:57 PM< DATA: i_message TYPE STANDARD TABLE OF solisti1,
i_attach TYPE STANDARD TABLE OF solisti1,
i_attach_body TYPE STANDARD TABLE OF solisti1,
i_suc_notify TYPE STANDARD TABLE OF zifdl,
i_mail_rcpnts TYPE STANDARD TABLE OF zbss_mail.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment.
*& Form BUILD_XLS_DATA_TABLE
Populate table with detaisl to be entered into .xls file
FORM build_xls_data_table .
CONSTANTS: l_c_head1 TYPE char20 VALUE 'Credit Card Type', "#EC NOTEXT
l_c_head2 TYPE char20 VALUE 'OrigSysRef',
l_c_head3 TYPE char20 VALUE 'OrderNum',
l_c_head4 TYPE char20 VALUE 'OrigSysLineRef',
l_c_head5 TYPE char20 VALUE 'LineNum',
l_c_head6 TYPE char20 VALUE 'ItemNum',
l_c_head7 TYPE char20 VALUE 'LineAmt',
l_c_head8 TYPE char20 VALUE 'ScheduleDate',
l_c_head9 TYPE char20 VALUE 'ReqDate',
l_c_head10 TYPE char20 VALUE 'PromiseDate',
l_c_head11 TYPE char20 VALUE 'AuthReqDate'.
DATA:
l_vtext TYPE char50, "Credit Card Type
l_bstnk TYPE char20, "OrigSysRef
l_vbeln TYPE char20, "OrderNum
l_posex TYPE char20, "OrigSysLineRef
l_posnr TYPE char20, "LineNum
l_matnr TYPE char20, "ItemNum
l_netwr TYPE char20, "LineAmt
l_lddat TYPE char20, "ScheduleDate
l_vdatu TYPE char20, "ReqDate
l_edatu TYPE char20, "PromiseDate
l_req_date TYPE char20, "AuthReqDate
l_sub_tot TYPE vbap-netwr,
l_sto TYPE char20,
l_v_datum TYPE char10,
l_v_time TYPE char10,
l_dummy TYPE char20.
DATA: l_wa_attach TYPE solisti1,
l_wa_attach_body TYPE solisti1,
l_wa_final TYPE t_final.
CLEAR: l_dummy.
CONCATENATE sy-datum(4) sy-datum4(2) sy-datum6(2) INTO l_v_datum SEPARATED BY '/'.
CONCATENATE sy-uzeit(2) sy-uzeit2(2) sy-uzeit4(2) INTO l_v_time SEPARATED BY ':'.
This table contain actual column headings for the fields in the attachment
CLEAR: l_wa_attach.
CONCATENATE text-011
cl_abap_char_utilities=>horizontal_tab
text-003
cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>horizontal_tab
text-021
l_v_datum
l_v_time
cl_abap_char_utilities=>cr_lf
cl_abap_char_utilities=>cr_lf
INTO l_wa_attach SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
APPEND l_wa_attach TO i_attach.
CLEAR: l_wa_attach.
This table contain actual column headings for the fields in the attachment
CONCATENATE l_c_head1 l_c_head2 l_c_head3 l_c_head4 l_c_head5
l_c_head6 l_c_head7 l_c_head8 l_c_head9 l_c_head10
l_c_head11 cl_abap_char_utilities=>cr_lf
INTO l_wa_attach SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
APPEND l_wa_attach TO i_attach.
CLEAR: l_wa_attach.
This table contain the actual contents of the attachment
SORT i_final BY vbeln posnr.
CLEAR: l_wa_final,l_wa_attach_body.
LOOP AT i_final INTO l_wa_final.
WRITE :
l_wa_final-vtext TO l_vtext,
l_wa_final-bstnk TO l_bstnk,
l_wa_final-vbeln TO l_vbeln,
l_wa_final-posex TO l_posex,
l_wa_final-posnr TO l_posnr,
l_wa_final-matnr TO l_matnr,
l_wa_final-netwr TO l_netwr CURRENCY 'VBAP-WAERK',
l_wa_final-lddat TO l_lddat,
l_wa_final-vdatu TO l_vdatu,
l_wa_final-edatu TO l_edatu,
l_wa_final-req_date TO l_req_date.
l_sub_tot = l_sub_tot + l_wa_final-netwr.
CONCATENATE l_dummy
l_vtext l_bstnk l_vbeln l_posex l_posnr l_matnr
l_netwr l_lddat l_vdatu l_edatu l_req_date
INTO l_wa_attach_body SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
APPEND l_wa_attach_body TO i_attach_body.
CLEAR: l_wa_attach_body.
AT END OF vbeln.
READ TABLE i_final INTO l_wa_final INDEX sy-tabix.
MOVE l_sub_tot TO l_sto.
CONCATENATE cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>horizontal_tab
'Order total'
l_sto
cl_abap_char_utilities=>cr_lf
INTO l_wa_attach_body SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
APPEND l_wa_attach_body TO i_attach_body.
CLEAR: l_sub_tot,l_sto,l_wa_attach_body.
ENDAT.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
DATA: l_v_desc TYPE sood1-objdes,
l_wa_suc_notify TYPE zifdl,
l_wa_mail_rcpnts TYPE zbss_mail.
Get the mail ids from distribution list
REFRESH: i_suc_notify.
SELECT * INTO TABLE i_suc_notify
FROM zifdl
WHERE zdstlist EQ p_disid.
IF sy-subrc <> c_zero.
Show exit msg if there is no distribution list maintained
MESSAGE e002 WITH text-014 p_disid.
ENDIF.
format the email id details
CLEAR: l_wa_suc_notify,l_wa_mail_rcpnts.
LOOP AT i_suc_notify INTO l_wa_suc_notify .
IF l_wa_suc_notify-zuserid CA '@'.
l_wa_mail_rcpnts-l_adr_name = l_wa_suc_notify-zuserid.
ELSE.
l_wa_mail_rcpnts-usrnam = l_wa_suc_notify-zuserid.
ENDIF.
APPEND l_wa_mail_rcpnts TO i_mail_rcpnts.
CLEAR: l_wa_mail_rcpnts,l_wa_suc_notify.
ENDLOOP.
Populate message body text
PERFORM populate_email_message_body.
Send the report output generated to the list of recipients
MOVE text-012 TO l_v_desc.
Send the e-mail with attachment
TRY.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
-------- create and set document with attachment ---------------
create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = i_content_body[]
i_subject = subject ).
Check if Attachment should be sent in mail
IF p_skip_attach IS INITIAL.
IF i_attachment_type = 'ALI'.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = i_attachment_type
i_attachment_subject = l_filename
i_att_content_hex = i_content_hex.
ELSE.
Get No of lines
DESCRIBE TABLE i_attach LINES l_lines.
Size to multiplied by no of lines
l_size = l_lines * 255.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = i_attachment_type
i_attachment_size = l_size
i_attachment_subject = i_filename
i_att_content_text = i_attach[].
ENDIF.
ENDIF.
add document to send request
CALL METHOD send_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
LOOP AT i_receivers INTO l_receiver_wa.
CLEAR l_mailaddr.
l_mailaddr = l_receiver_wa-receiver.
recipient = cl_cam_address_bcs=>create_internet_address(
l_mailaddr ).
add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = express
i_copy = ' '
i_blind_copy = ' '
i_copy = l_receiver_wa-copy
i_blind_copy = l_receiver_wa-blind_copy
i_no_forward = ' '.
ENDLOOP.
*Set sender based on l_userid
lo_sender = cl_sapuser_bcs=>create( l_userid ).
CALL METHOD send_request->set_sender( EXPORTING i_sender = lo_sender ).
---------- send document ---------------------------------------
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF i_bypass_commit IS INITIAL.
COMMIT WORK.
ENDIF.
* exception handling
CATCH cx_bcs INTO bcs_exception.
ENDTRY. >
Edited by: sugunav on Sep 8, 2009 4:41 PM
Maybe you are looking for
-
Creation of PO's from Order Management
Required Business Scenario Customer orders are received via the internet and imported into Oracle Order Management via an open interface table. The customer orders are processed by Oracle OM and converted to Purchase Orders which are then sent to sup
-
I just moved and am setting up a new apartment. Verizon put in internet service yesterday. I got a network going on my airport extreme but it could not connect to the internet because it says it has no DNS servers. help! What do I do now?
-
Acrobat File Not Found After Printing Web Page
Here is my problem: I am trying to print a web page from our intranet but once the process is complete, a log file opens saying: "The system cannot find the file" and then it lists the file I just tried to create. The page is basic HTML with a small
-
Regular Expressions help needed.
Hi, I have lines like <div id="contentSub"> 26 /*]]>*/</style> 27 <ul> 30 Dylan is gay 36 var wgNamespaceNumber = 0; 41You see every line is contained a string plus some white spaces then pl
-
ODBC driver for Oracle 8.1.5 in Unix
Can anybody tell me , how will I make sure that ODBC driver for Oracle 8.1.5 installed in Unix ?.