Sending file in file through E-mail
I think this must be very simple to do, but I have to ask for instructions. All I want to do is to type a short message (one sentence) and put it into a box labeled (?). I would like to be able send the box-in-a-box by E-mail. At the other end, one click on the box with the question mark on it would open to show the message. Simple, but I don't know how to do it. Also, I might as well ask if it would be possible to open the mystery box to see the message and hear music. Well, I can ask, can't I?
Hey
Please have a look at the following blog
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
Thanx
Aamir
Similar Messages
-
I'm unable to send and receive email through Apple Mail 4. I've checked my settings on Preferences, and my password to Gmail is up to date for syncing with IMAP, but it still won't connect. Suggestions?
I think it's trying to open it in a gMail eMail & is losing your gMail password that it needs log into gMail, but not 100% positive.
Have you tried Right clicking or Control+click on the eMail link & choose Copy? Works on some, not others. -
When I try to send a document out through my e-mail, it does not open for me to send e-mail. This was never a problem it seems until last Pages update. What do you recommend?
We are not mind readers.
What version of Pages (don't say latest), and version of OS X? -
Some pdf files not coming through in Mail
Different people have sent me pdf files and having trouble.
yesterday someone sent 2 at once and then sent 1 each and it worked.
today someone sent 1 and it didn't work
What happens is that the pdf file is with the email if I look in View Source but the regular Adobe pdf icon does not show up in the mail window or as an attachment, what shows up is a small black square. When I drag the square to the desktop and try to open it this is the message:
Adobe Reader could not open '45605_060608[1].pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
ANYONE ELSE having a problem with pdf's in Mail?
COULD IT BE Adobe Reader? I did have to upgrade it a couple days ago.
Thanks in advance.Nope, rebuilding not a fix.
Problem has to do with sender using Exchange server. Narrowed it down to one company (GE no less)... used to have a .doc file problem and had to use TNEF's Enough ...
I can access the pdf's using my webmail... it's just when Apple Mail get's involved... but it's a "on their end" encryption issue, not Mail, it would probably be a problem if I used Entourage or some other mail client.
Thanks for all help! -
Sending Output of SQL Through UTL Mail
Hello,
We have oracle 10gR2 on sun solaris.
I need to email an output of a SQL Qurey by using utl_mail or some other method.
Can anyone of you point on how I can do that.
ThanksI am spooling the output to a file and trying to send as an attachment. I receive the mail with an text.txt attachment , but it does not show the actual data. Am I doing wrong in any declaration.And that is the wrong thing to do. Do not spool anything to file. It is not needed.
First you need to understand how an e-mail looks like. It has a header - this includes the subject, the recipients, the sender, and so on. A blank line. Then the e-mail body follows. The e-mail body can have boundary lines, splitting the body into parts. A part can be, for example, an attachment. This part will contain the type of data in that boundary. And in the case of an attachment, the filename to use to save that boundary's contents as a file.
And this is what UTL_MAIL does - it creates such an e-mail body for you. It puts the contents of the attachment parameter into the e-mail body. It uses the filename in the header part of that boundary to tell the e-mail reader what the filename is for that contents.
Using the following UTL_MAIL code:
SQL> declare
2 begin
3 SYS.UTL_MAIL.send_attach_varchar2(
4 sender => '[email protected]'
5 ,recipients => '[email protected]'
6 ,cc => NULL
7 ,bcc => NULL
8 ,subject => 'Sample Mail from UTL_MAIL'
9 ,message => 'This line will be written to message '||
10 'body - a boundary will be written after it to write the attachment.'
11 ,mime_type => 'text/plain; charset=us-ascii'
12 ,priority => 2
13 ,attachment => '<html><table><tr><td>Row 1</td><td>data..</td></tr>'||
14 '<tr><td>Row 2</td><td>data..</td></tr></table></html>'
15 ,att_inline => TRUE
16 ,att_mime_type => 'text/html'
17 ,att_filename => 'sample-attachment.html'
18 );
19 end;
20 /
PL/SQL procedure successfully completed.Results in the following e-mail being generated and send via SMTP:
From: [email protected]
To: [email protected]
Subject: =?ISO-8859-1?Q?Sample=20Mail=20from=20UTL=5FMAIL?=
X-Priority: 2
Content-Type: multipart/mixed; boundary="------------4D8C24=_23F7E4A13B2357B3"
Return-Path: [email protected]
Date: 12 Nov 2009 07:20:52 +0200
Mime-Version: 1.0
This is a multi-part message in MIME format.
--------------4D8C24=_23F7E4A13B2357B3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
This line will be written to message body - a boundary will be written after it to write the attachment.
--------------4D8C24=_23F7E4A13B2357B3
Content-Type: text/html; name="sample-attachment.html"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="sample-attachment.html"
<html><table><tr><td>Row 1</td><td>data..</td></tr><tr><td>Row 2</td><td>da=
ta..</td></tr></table></html>
--------------4D8C24=_23F7E4A13B2357B3-- -
How to send existing excel file through mail
Hello Friends,
I have to send mail with Excel File attachement. i have already exist Excel file and that file i hv to send through mail. so pl help me out for sending existing excel file .
i.e. user pickup the exist excel file and that file would be sent to particular mail id.
thank you,
MarmikHi marmik,
1. There is some trick involved
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
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.
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
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
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
regards,
amit m. -
How to send a text file attachment through mail in ECC 6.0
Hi Friends,
As per the requirement, I need to send a ALV report result as text file attachment to user in ECC 6.0 . I know how to do in 4.6C version. But the same code is not working here in ECC 6.0.
Generally to get the data in new row in the text file we use below code in 4.6c.
data: c_value type x value ' 0D '.
concatenate c_value itab-line into itab-line.
By using above code, we get each row of the itab in a new line in text file.
Same code is not working in ECC6.0 as it is not supporting to concatenate bytes with characters. Getting the error like " field c_value should be diclared as type C or I or N or T or P"
Even I have used function module NLS_STRING_CONVERT_TO_SYS to convert hexa to char. It is converting the value' 0D' to ' # '. But it is not working.
Could you please suggest me that how can get each row of itab as a new line in text file in ECC 6.0.
Itab value:
abcdefdfldjfñlkdsjfñldsjfdsñljñla
fdsljfñldskjfldsñkjfñldsjfñldsajñld
vcxusfcxusfcusafcxusafcusafcdsauc
Actual result currently coming in text file:
abcdefdfldjfñlkdsjfñldsjfdsñljñlafdsljfñldskjfldsñkjfñldsjfñldsajñldvcxusfcxusfcusafcxusafcusafcdsauc
Expected result in text file:
abcdefdfldjfñlkdsjfñldsjfdsñljñla
fdsljfñldskjfldsñkjfñldsjfñldsajñld
vcxusfcxusfcusafcxusafcusafcdsauc
Please do the needful.
Thanks
Kumarhi,
Try this function Module
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1 '
*example code
******* 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 = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smartform'.
concatenate i_objpack-obj_name i_objpack-doc_type into
i_objpack-obj_descr separated by '.'.
* I_OBJPACK-OBJ_DESCR = 'test'.
i_objpack-doc_size = v_lines_bin * 255 .
append i_objpack.
* Länge des Attachment ermitteln
clear i_reclist.
i_reclist-receiver = 'email address'.
i_reclist-rec_type = 'U'.
i_reclist-express = 'X'.
data: tab_lines like sy-tabix.
describe table i_objbin lines tab_lines.
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. -
How to send generated Spool file through e-mail
Hi,
We have a ABAP report which generates a spool file. Now there is a requirement to send this spool file to our clients external mail boxes.
Also we would like to automate this so that whenever a spool file is generated, the system should automatically send it as an attachment to user mail inboxes.
Any idea how I can achieve this. Thanks is advance!
Regards,
Vikrant.Hi Vikrant,
Have a look at this code...
z_send_email_fax_global
FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat like sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
=================================================================================
z_send_email_fax2
FUNCTION z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc NE 0.
RAISE err_no_abap_spooljob. "doesn't exist
ELSE.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-recesc = object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
ENDFUNCTION.
=================================================================================
z_send_email_fax
FUNCTION ZCBFS_SEND_MAIL.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" TABLES
*" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
DATA: vg_achou(1) TYPE n.
Fist part: Verify if the spool really exists
vg_achou = 1.
DO 60 TIMES.
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc IS INITIAL.
CLEAR vg_achou.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF vg_achou = 1.
RAISE err_no_abap_spooljob. "doesn't exist
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
LOOP AT LIST_FAX_MAIL_NUMBER.
lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
lt_rec_tab-recesc = 'U'.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
ENDLOOP.
lt_files-file = c_file.
APPEND lt_files.
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDFUNCTION.
Regards,
Santosh -
Difficulty sending attached wProjector files through e-mail
Does anybody know why the "exe" in wProjector.exe files are deemed to be "Illegal" by the Web Postmaster?
I tried to send one attached to an e-mail this afternoon and it was returned. Need help!exe (executable) files are probably the highest on the list of files that can carry viruses or otherwise do malicious damage to the machines they land in during their travels.
exe files generally run by doubleclicking them, without the need for supporting software. Years ago, people with malicious tendencies would have viral exe files attached to emails which baited/misled the recipient into opening the file (running it by simply clicking it) -
Sending Body of letter Through mail along with PDF file.
Dear friends,
I want to write some text in the mail(Body) while sending the PDF file.
Now I am sending PDF file , besides PDF file I have to write some text in the mail.
Please help me .
Thanks ,
Praveen.here is sample code.... Check the perform set_up_email_body.....
FORM send_mail .
Set up the header,body ,file attachment of the message.
PERFORM set_up_email_hdr.
PERFORM set_up_email_body.
PERFORM set_up_att_file.
CLEAR: wa_objtxt.
SORT t_fieldcat BY no_out col_pos.
Set up patcking list for attachment
wa_objpack-body_start = w_tabln + 1.
Loop at report and separate by semi-colons
CLEAR: w_tabln.
SORT t_fieldcat BY no_out col_pos.
Loop at report and append header values
LOOP AT t_fieldcat INTO fs_fieldcat WHERE no_out = space.
IF wa_objtxt IS INITIAL.
wa_objtxt = fs_fieldcat-seltext_l.
ELSE.
CONCATENATE wa_objtxt
fs_fieldcat-seltext_l
INTO wa_objtxt
SEPARATED BY c_comma.
ENDIF. " IF WA_OBJTXT ...
CONDENSE wa_objtxt NO-GAPS.
ENDLOOP. " LOOP AT T_FIELDCAT ...
IF sy-subrc EQ 0.
APPEND wa_objtxt TO t_objtxt.
ENDIF. " IF SY-SUBRC ...
Fill Email attachment
PERFORM fill_email_report.
DESCRIBE TABLE t_objtxt LINES w_tabln.
CLEAR W_LINE.
READ TABLE t_objtxt INTO w_line INDEX w_tabln.
IF SY-SUBRC EQ 0.
fs_docda-doc_size = ( w_tabln - c_1 ) * 255 + STRLEN( w_line ).
wa_objpack-body_num = w_tabln.
wa_objpack-doc_size = w_tabln * 255.
APPEND wa_objpack TO t_objpack.
Add receipients to the mail.
PERFORM add_recipients.
send the mail
PERFORM call_send.
ENDIF. " IF SY-SUBRC EQ 0.
ENDFORM. " SEND_MAIL
*& Form add_recipients
This subroutine is used to add receipients to send mail.
There are no parameters passed to this subroutine.
FORM add_recipients .
IF p_user IS NOT INITIAL.
wa_receiver-receiver = p_user.
wa_receiver-rec_type = c_u.
APPEND wa_receiver TO t_receiver.
ELSE.
wa_receiver-receiver = p_dlist.
wa_receiver-rec_type = c_c.
APPEND wa_receiver TO t_receiver.
ENDIF. " IF P_USER ...
ENDFORM. " ADD_RECIPIENTS
*& Form call_send
This subroutine is used to send the mail.
There are no parameters passed to this subroutine.
FORM call_send .
IF t_objtxt[] IS NOT INITIAL.
Send the mail.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = fs_docda
put_in_outbox = c_x
commit_work = c_x
TABLES
packing_list = t_objpack
object_header = t_objhead
contents_txt = t_objtxt
receivers = t_receiver
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 NE 0.
MESSAGE s100(ra) WITH text-e05.
STOP.
ELSE.
MESSAGE s100(ra) WITH text-026.
ENDIF. " IF SY-SUBRC ...
ELSE.
MESSAGE s100(ra) WITH text-029.
STOP.
ENDIF. " IF T_OBJTXT[] ...
ENDFORM. " CALL_SEND
*& Form set_up_email_hdr
This subroutine is used to Setup the attributes of the Document
There are no interface parameters to this subroutine.
FORM set_up_email_hdr .
MOVE text-i03 TO fs_docda-obj_name.
IF sy-sysid+0(1) NE c_p.
CONCATENATE text-i02 text-i03 INTO fs_docda-obj_descr.
ELSE.
MOVE text-i03 TO fs_docda-obj_descr.
ENDIF. " IF SY-SYSID+0(1) ...
ENDFORM. " SET_UP_EMAIL_HDR
*& Form set_up_email_body
This subroutine is used to set body of an email
There are no interface parameters to this subroutine.
FORM set_up_email_body .
Setting the attributes of the document.
IF P_ZCR3 EQ C_X.
wa_objtxt-line = text-007.
ELSEIF P_REL EQ C_X AND P_CHECK NE C_X.
wa_objtxt-line = text-008.
ELSEIF P_REL EQ C_X AND P_CHECK EQ C_X.
wa_objtxt-line = text-008.
ELSE.
wa_objtxt-line = text-009.
ENDIF. " IF P_ZCR3 ...
APPEND wa_objtxt TO t_objtxt.
DESCRIBE TABLE t_objtxt LINES w_tabln.
CLEAR W_LINE.
READ TABLE t_objtxt INTO w_line INDEX w_tabln.
IF SY-SUBRC EQ 0.
fs_docda-doc_size = ( w_tabln - 1 ) * 255 + STRLEN( w_line ).
wa_objpack-head_start = c_1.
wa_objpack-head_num = c_0.
wa_objpack-body_start = c_1.
wa_objpack-body_num = w_tabln.
wa_objpack-doc_type = c_RAW.
APPEND wa_objpack TO t_objpack.
ENDIF. " IF SY-SUBRC EQ 0.
ENDFORM. " SET_UP_EMAIL_BODY
*& Form set_up_att_file
This subroutine is used to set up an attachment file.
There are no interface parameterst that need to be passed to
this subroutine.
FORM set_up_att_file .
Attaching the file to the mail.
wa_objhead-line = c_fname.
APPEND wa_objhead TO t_objhead.
wa_objpack-head_start = c_1.
wa_objpack-head_num = c_1.
wa_objpack-body_start = w_tabln.
wa_objpack-doc_type = c_CSV.
IF P_ZCR3 EQ C_X.
wa_objpack-obj_name = text-012.
wa_objpack-obj_descr = text-012.
ELSEIF P_REL EQ C_X.
wa_objpack-obj_name = text-027.
wa_objpack-obj_descr = text-027.
ELSE.
wa_objpack-obj_name = text-028.
wa_objpack-obj_descr = text-028.
ENDIF. " IF P_ZCRE EQ....
ENDFORM. " SET_UP_ATT_FILE -
Need to Generate PDF file and send it to customer through email-ALV report
HI All,
I am having data in Internal table.
can we create PDF file with out having spool-request number.
My requirement is whenever user clicks on execute button the output is generated in PDF format automatically and then send it to customer through email.
I found few programs in SDN for generation PDF. But problem is everyone passing the spool request to the function module.
spool request will be generated whenever we click on print button.
Am I correct?.
Is there any other way to create spool request automatically. If so we can pass the this spool number to the function module.
Regards,
vinod.hi
For sending a mail, this code will help you.
Pls reward if help.
FORM send_mail_2 USING msgid msgno msgv1.
mailuser oder Gruppe like sy-uname default 'Ruckerk'.
DATA: express_hold_time LIKE sovaltime.
DATA: text LIKE sotxtinfo.
DATA: receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
MESSAGE ZF100 (FTP an UDB fehlgeschlagen)
text-msgid = msgid.
text-msgno = msgno.
text-msgv1 = msgv1.
text-msgv2 = ' '.
text-msgv3 = ' '.
text-msgv4 = ' '.
express_hold_time
express_hold_time-days = 01.
express_hold_time-h_min_sec = 240000.
receiver
receiver-receiver = mreceivr.
Gruppe von Empfängern
receiver-rec_type = 'C'.
und Expressmeldung ausgeben
receiver-express = 'X'.
APPEND receiver.
CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'
EXPORTING
msgid = text-msgid
msgno = text-msgno
msgv1 = text-msgv1
msgv2 = text-msgv2
msgv3 = text-msgv3
TABLES
receivers = receiver.
IF sy-subrc <> 0.
WRITE:/ 'hat nicht geklappt', 'SY-SUBRC =', sy-subrc.
ENDIF.
PERFORM print_error_report.
Fehlermeldung zum Abbrechen des Report's ausgeben.
MESSAGE e398 WITH 'Jobabbruch' msgv1.
ENDFORM. " SEND_MAIL_2
Another Program:
*& 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 -
Variable file name through Receiver mail Communication channel
I need to send a file through receiver communication channel with the following name ( YYMMDD schema) . The YYMMDD is current date . I know how to create these file names throug FCC ( file communication channel) , I tried in the same manner to create this file through Receiver Mail CC , but it did not work . If you have any ideas , can you please share with me ?
ABC_MMYYDD.TXT
Thanks.
RitvikHi Ritvik,
Also, Please look at this link and see if it helps you. It is generating variable file name through a UDF
Re: Problem in dynamically file name generation procedure
Best Regards -
How To send a PDF file to mail
Hi Friends,
I am having a file (D:\file.pdf) in ' D ' directory . Now I want to send this pdf to perticular mail id ([email protected]). I tried so many examples but i am not able to solve this problem so please help to solve this one.
I tried SO_NEW_DOCUMENT_SEND_API1 function modules and all but i am not getting please send small sample code .
Thanks and Regards,
Phani.go through this report=>
: Report ZSAPTALK :
: Author SAPdev.co.uk :
: Description : :
: Send mail message to SAP mail inbox. :
: Please visit www.sapdev.co.uk for further info :
REPORT ZSAPMAIL NO STANDARD PAGE HEADING.
TABLES: DRAD,
QINF,
DRAW,
SOUC,
SOFD,
DRAP.
DATA: P_RETURN_CODE LIKE SY-SUBRC.
data: d_username LIKE DRAP-PRNAM.
mail declarations
DATA : BEGIN OF NEW_OBJECT_ID. " the newly created email object
INCLUDE STRUCTURE SOODK.
DATA : END OF NEW_OBJECT_ID.
DATA : BEGIN OF FOLDER_ID. " the folder id of the outbox
INCLUDE STRUCTURE SOODK.
DATA : END OF FOLDER_ID.
DATA : BEGIN OF REC_TAB OCCURS 5. " the table which will contain the
INCLUDE STRUCTURE SOOS1. " information on the destination
DATA : END OF REC_TAB.
DATA : BEGIN OF OBJECT_HD_CHANGE. " the table which contains the
INCLUDE STRUCTURE SOOD1. " info for the object we will be
DATA : END OF OBJECT_HD_CHANGE. " creating
DATA : OBJECT_TYPE LIKE SOOD-OBJTP. " the type of object
DATA : BEGIN OF OBJHEAD OCCURS 5. " the header of the object
INCLUDE STRUCTURE SOLI.
DATA : END OF OBJHEAD.
DATA : BEGIN OF OBJCONT OCCURS 0. " the contents of the object
INCLUDE STRUCTURE SOLI. " i.e. the text etc
DATA : END OF OBJCONT.
DATA : BEGIN OF OBJPARA OCCURS 5. " formatting options
INCLUDE STRUCTURE SELC.
DATA : END OF OBJPARA.
DATA : BEGIN OF OBJPARB OCCURS 5. " formatting options
INCLUDE STRUCTURE SOOP1.
DATA : END OF OBJPARB.
DATA : BEGIN OF T_MAIL_TEXT OCCURS 0, "Message table for messages to
STRING(255), "user via mailbox
END OF T_MAIL_TEXT.
Parameter: p_uname like sy-uname.
**START-OF-SELECTION
START-OF-SELECTION.
d_username = p_uname.
PERFORM POPULATE_EMAIL_TEXT.
PERFORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
PERFORM CREATE_AND_SEND_MAIL_OBJECT.
FORM POPULATE_EMAIL_TEXT *
Inserts text for email message *
FORM POPULATE_EMAIL_TEXT.
CLEAR T_MAIL_TEXT-STRING. "puts a blank line in
APPEND T_MAIL_TEXT.
APPEND T_MAIL_TEXT.
adds failed list on to end of success list.
T_MAIL_TEXT-STRING = 'Test email message line 1'.
APPEND T_MAIL_TEXT.
T_MAIL_TEXT-STRING = 'Test email message line 1'.
APPEND T_MAIL_TEXT.
CLEAR T_MAIL_TEXT-STRING. "puts a blank line in
APPEND T_MAIL_TEXT.
T_MAIL_TEXT-STRING = 'Header1 Header2 Header3'.
APPEND T_MAIL_TEXT.
T_MAIL_TEXT-STRING = '----
APPEND T_MAIL_TEXT.
ENDFORM.
*& Form SETUP_TRX_&_RTX_MAILBOXES
Ensure that the mailboxes of the sender (INTMGR) are set up OK
FORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
get the user no of the sender in order to add the mail to the
user name's outbox for future reference
SELECT SINGLE * FROM SOUC
WHERE SAPNAM = SY-UNAME. "SAP name of a SAPoffice user
IF SY-SUBRC NE 0.
"Error finding the SAPoffice user info for the user
MESSAGE E064(ZR53) WITH SY-UNAME.
P_RETURN_CODE = 1.
EXIT.
ENDIF.
*Get the outbox No for the sender from the user No where the folder
" type is an outbox
SELECT * FROM SOFD WHERE OWNTP = SOUC-USRTP "Owner type from ID
AND OWNYR = SOUC-USRYR "Owner year from the ID
AND OWNNO = SOUC-USRNO "Owner number from the I
AND FOLRG = 'O'."Output box
ENDSELECT.
IF SY-SUBRC NE 0.
" Error getting folder information for the user
MESSAGE E065(ZR53) WITH SY-UNAME.
P_RETURN_CODE = 1.
EXIT.
ENDIF.
ENDFORM. " SETUP_TRX_&_RTX_MAILBOXES
*& Form CREATE_AND_SEND_MAIL_OBJECT
FORM CREATE_AND_SEND_MAIL_OBJECT.
FOLDER_ID-OBJTP = SOFD-FOLTP. " the folder type ( usually FOL )
FOLDER_ID-OBJYR = SOFD-FOLYR. " the folder year ( usually 22 )
FOLDER_ID-OBJNO = SOFD-FOLNO. " the folder no.
OBJECT_TYPE = 'RAW'. " the type of object being added
build up the object information for creating the object
OBJECT_HD_CHANGE-OBJLA = SY-LANGU. " the language of the email
OBJECT_HD_CHANGE-OBJNAM = 'PS to DM Interface'. " the object name
mail subject 'Mass Linking of QA, pass/fail'
MOVE TEXT-002 TO OBJECT_HD_CHANGE-OBJDES.
OBJECT_HD_CHANGE-DLDAT = SY-DATUM. " the date of the email
OBJECT_HD_CHANGE-DLTIM = SY-UZEIT. " the time of the email
OBJECT_HD_CHANGE-OBJPRI = '1'. " the priority ( highest )
OBJECT_HD_CHANGE-OBJSNS = 'F'. " the object sensitivity
F is functional, C - company sensitive
object_hd_change-skips = ' '. " Skip first screen
object_hd_change-acnam = 'SM35'. " Batch imput transaction
object_hd_change-vmtyp = 'T'. " Transaction type
add the text lines into the contents of the email
CLEAR OBJCONT.
REFRESH OBJCONT.
free objcont. " added this to delete the mail contents records
LOOP AT T_MAIL_TEXT.
OBJCONT-LINE = T_MAIL_TEXT-STRING.
APPEND OBJCONT.
ENDLOOP.
CLEAR OBJCONT.
build up the table of receivers for the email
REC_TAB-RCDAT = SY-DATUM. " the date to send the email
REC_TAB-RCTIM = SY-UZEIT. " the time to send the email
the SAP username of the person who will receive the email
REC_TAB-RECNAM = D_USERNAME.
the user type of the person who will send the email ( USR )
REC_TAB-SNDTP = SOUC-USRTP.
the user year of the person who will send the email ( 22 )
REC_TAB-SNDYR = SOUC-USRYR.
the user number of the person who will send the email
REC_TAB-SNDNO = SOUC-USRNO.
the sap username of the person who will send the email
REC_TAB-SNDNAM = SY-UNAME.
get the user info for the receiver of the document
SELECT SINGLE * FROM SOUC WHERE SAPNAM = D_USERNAME.
IF SY-SUBRC NE 0.
WRITE : / TEXT-001, D_USERNAME. "usnam.
EXIT.
ENDIF.
the user number of the person who will receive the email ( USR )
REC_TAB-RECNO = SOUC-USRNO.
the user type of the person who will receive the email ( USR )
REC_TAB-RECTP = SOUC-USRTP.
the user year of the person who will receive the email ( USR )
REC_TAB-RECYR = SOUC-USRYR.
the priority of the email ( highest )
REC_TAB-SNDPRI = '1'.
check for delivery on the email
REC_TAB-DELIVER = 'X'.
send express so recipient knows there is a problem
REC_TAB-SNDEX = 'X'.
check for a return receipt
REC_TAB-READ = 'X'.
the sap username of the person receiving the email
REC_TAB-ADR_NAME = D_USERNAME. "usnam.
add this receiver to the internal table
APPEND REC_TAB.
CLEAR REC_TAB.
call the function to create the object in the outbox of the sender
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
FOLDER_ID = FOLDER_ID
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = OBJECT_TYPE
OWNER = SY-UNAME
IMPORTING
OBJECT_ID = NEW_OBJECT_ID
TABLES
OBJCONT = OBJCONT
OBJHEAD = OBJHEAD
OBJPARA = OBJPARA
OBJPARB = OBJPARB
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
DL_NAME_EXIST = 4
FOLDER_NOT_EXIST = 5
FOLDER_NO_AUTHORIZATION = 6
OBJECT_TYPE_NOT_EXIST = 7
OPERATION_NO_AUTHORIZATION = 8
OWNER_NOT_EXIST = 9
PARAMETER_ERROR = 10
SUBSTITUTE_NOT_ACTIVE = 11
SUBSTITUTE_NOT_DEFINED = 12
SYSTEM_FAILURE = 13
X_ERROR = 14
OTHERS = 15.
IF SY-SUBRC NE 0.
MESSAGE A063(ZR53) WITH SY-SUBRC.
EXIT.
ENDIF.
call the function to send the already created email to the receivers
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
FOLDER_ID = FOLDER_ID
OBJECT_ID = NEW_OBJECT_ID
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
TABLES
RECEIVERS = REC_TAB
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
X_ERROR = 20
OTHERS = 21.
IF SY-SUBRC EQ 0.
MESSAGE I035(ZR53) WITH NEW_OBJECT_ID D_USERNAME. "usnam.
ELSE.
MESSAGE I036(ZR53) WITH D_USERNAME." sy-subrc.
ENDIF.
ENDFORM. " CREATE_AND_SEND_MAIL_OBJECT
Also, check links....
http://help.sap.com/saphelp_nw04s/helpdata/en/38/71f865c2c9a94ab1dce95792187c16/content.htm
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm -
Need to send the zip file to mail as an attachment
i want to pick the zip file which consists some 2,3 files inside it. and send as it is to mail as an attachment.what i did is
i have taken one zip file,,, "testing.zip" inside it i have "test1.txt" & "test2.csv"
i created sender CC ,,in that i used module payloadzipbean and unzipped and called the file adapter.. created reciever CC as mail ..used same payload module now here i zipped all the payloads.
Result..i see the attachment coming as "test1.txt.zip" ..here i can see inside this zipfile my original file names as "test1.txt"&"test2.csv" as i enabled ASMA in both CC.
issues:i am unable to get the original file name like "testing.zip" ,,
can anyone help me in this.
Regards,
LoordhHi all,
as i posted last time my requirement ,i am going with java mapping for my scenario. i am using this code .
http://wiki.sdn.sap.com/wiki/display/XI/Dynamicfilenameforpass-through+scenario
this is working perfect for zip file (file to file) scenario. but my scenario is file to mail ..as i need to send this to mail package there it is throwing error.i am getting "zip file name as attachment properly but when i try to open it is giving error in zip file." this is what i modied code ..i am able to see my messge in sender CC and reciever CC..any java experts please help on this.
try {
// create XML structure of mail package
String output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"
+ "<Subject>" + mailSubject + "</Subject>"
+ "<From>" + mailSender + "</From>"
+ "<To>" + mailReceiver + "</To>"
+ "<Content_Type>multipart/mixed; boundary=\"" + boundary + "\"</Content_Type>"
+ "<Content>";
out.write(output.getBytes());
// create the declaration of the MIME parts
//First part
output = "--" + boundary + CRLF
+ "Content-Type: text/plain; charset=UTF-8" + CRLF
//+ "Content-Transfer-Encoding: 8bit" + CRLF
+ "Content-Disposition: inline" + CRLF + CRLF
+ mailContent + CRLF
//Second part
+ "--" + boundary + CRLF
+ "Content-Type: Application/zip; name=" + attachmentName + CRLF
//+ "Content-Transfer-Encoding: base64" + CRLF
+ "Content-Disposition: attachment; filename=" + attachmentName + CRLF + CRLF;
out.write(output.getBytes());
//Source is taken as attachment
copySource(in, out);
out.write("</Content></ns:Mail>".getBytes());
} catch (IOException e) {
throw new StreamTransformationException(e.getMessage());
protected static void copySource(InputStream in, OutputStream out)
throws IOException {
byte[] bbuf = new bytehttp://in.available();
int bblen = in.read(bbuf);
if (!(bblen < 0)) {
//String sbuf = new String(bbuf);
//String encoded = Base64.encode(sbuf);
// replace all control characters with escape sequences
//sbuf = sbuf.replaceAll("&", "&");
//sbuf = sbuf.replaceAll("\"", """);
//sbuf = sbuf.replaceAll("'", "'");
//sbuf = sbuf.replaceAll("<"<");
//sbuf = sbuf.replaceAll(">", ">");
out.write(bbuf);}} -
Hidden files sent through Apple Mail
Whenever I send attachments through Apple Mail, I get these 1KB files showing up in the attachment. For example, if I attached and sent a 1MB file called "photo1.jpg" through Apple Mail, my friends receive two files; 1 MB file called photo1.jpg and another one 1KB file by the same name. If I sent two attached files, I get two more 1KB files by the same name. Depending on how large the main file is the other file may vary from 1KB - 8KB.
I do not know how to avoid sending something I do not see.
Are these .ds_store files? When I sent this to myself on Gmail through Apple Mail I get the same. So, it is not as if ONLY windows guys see them. I can also see them in my Safari.
Please help.This is likely the results of the AppleDouble MIME encoding mechanisms used within your Apple Mail client; the second hunk is the resource fork from the image file.
You can ignore it, or you can switch to a sending client that doesn't generate the AppleDouble MIME message (and the resource fork), or you can switch to a receiving client that does.
Reading fodder (though potentially more detail than you probably want) is available:
http://home.earthlink.net/~bobbau/email/more-tips/
http://db.tidbits.com/article/05787
There are other discussions of the AppleDouble format around.
The Windows Friendly switch disables this mechanism; the resource fork is not sent within the MIME-encoded message. -
Corrupted file when sent through mail
Hello,
I wrote a script that, among other things, sends an email with an attached binary file.
This goes through an SMTP relay server.
The problem is that the file gets corrupted along the way. something, somewhere, removes all 0x00 entries within the binary file.
I wonder if this could be due to the method I use to send the email.
Could someone have a look at this sub please ?
Sub SendMail (AttachmentFile)
Const SMTPServer = "zcabb37s.mydom.com"
Const SMTPServerPort = 25
Const MailExp = "[email protected]"
Dim Recipents, objMessage
Recipents = ""
For i = 0 To WScript.Arguments.Count - 1
If Len (Recipents) = 0 Then
Recipents = WScript.Arguments (i)
Else
Recipents = Recipents & "; " & WScript.Arguments (i)
End If
Next
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Stats du jour"
objMessage.From = MailExp
objMessage.To = Recipents
On Error Resume Next
objMessage.AddAttachment AttachmentFile
If Err.Number <> 0 Then
Call Echo ("Could not find attachment : " & " - " & Err.Number & Err.Source & " - " & Err.Description, 12)
Call Echo ("with " & AttachmentFile, 1)
WScript.Quit (5)
End If
On Error Goto 0
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPServerPort
objMessage.Configuration.Fields.Update
On Error Resume Next
objMessage.Send
If Err.Number <> 0 Then
Call Echo ("Could not send mail : " & " - " & Err.Number & Err.Source & " - " & Err.Description, 12)
Call Echo ("to " & Recipients, 1)
Call Echo ("with " & AttachmentFile, 1)
WScript.Quit (5)
End If
On Error Goto 0
Call Echo ("Mail sent to : " & Recipents & ".", 1)
Call Echo ("with attached file : " & AttachmentFile, 1)
End SubThis is not a scripting issue. Contact the server vendor or admin and ask them why they are doing that.
Perhaps you have a Unicode file that is being handled incorrectly. EXE files and binary files are usually blocked by mail systems.
The CDO package does not alter files. Only mail servers and mail clients will do that.
Try sending the file with PowerSHell to see that the same thing happens.
¯\_(ツ)_/¯
Maybe you are looking for
-
Thimble won't show any details on my "broken" code - I can't figure out the problem.
I am trying to add a line for the background image. I followed the thimble example and have tried numerous links, all resulting in a red exclamation mark. I'm not sure what the problem is and nothing happens when I click the exclamation mark. I also
-
Cannot disable spotlight - endlessly indexing
Hello all, I cannot disable spotlight - it is endlessly indexing. I have dropped the main drive into Provacy under Spotlight. I have dropped my other 3 drives there as well. I have taken them out and reurned them many times - no change. I repaire
-
JTree questions (1) Re-populating (2) Adding popups
Hi all, I've just started to use a JTree in my application and I've encountered two problems. Sorry if these have been covered before - I've been Googling around for answers. I have a UI panel ... http://photos1.blogger.com/blogger/541/411/1600/TreeD
-
hi please answer this questions, if anyone knows a) With C++, object reference counts are frequently used to keep track of how many references to an object exist. Is there a need for such a reference count for objects with Java? Please explain why or
-
Hiding Total of the Columns in the Class CL_SALV_TABLE
Hi , I am using the class CL_SALV_TABLE for displaying ALV outputs. The client is adamant on using this class only for ALV o/p. In on o/p there are some subtotals and totals calculation. I cannot remove the totals calculation. Only way is to hide it.