Send a mail with ppt file as an attachment
Hello,
I need to send an email which has a PPT file as an attachment. The file is on the hard drive of computer. I tried SO_DOCUMENT_REPOSITORY_MANAGER FM. It is asking for a dialog box but I need to design a scheduler which will send this email. Can you suggest any solution(which does not ask for a dialog box)?
Thanks,
Deepti.
Hi ,
If your requirement is to send email with attachment by selecting the attachment file from your local hardisk and execute.
and Next, specify the sender email address you can use the following code.
report zmail.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program
Similar Messages
-
Issue regarding sending E-Mail with PDF file(s) as attachment
Hi,
Can anybody provide me with code to send PDF file as E-Mail Attachment!
I know we have to use F.M <b>SO_NEW_DOCUMENT_ATT_SEND_API1</b> but how we have to use it to send PDF file as attachment!
I was able to send Text files as Attachments in my previous assignments.
Thanks in advance.
Thanks & Regards,
Kumar.Hi,
Check this threads:
SO_NEW_DOCUMENT_ATT_SEND_API1
unable to e-mail a pdf through FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'
SO_NEW_DOCUMENT_ATT_SEND_API1
Best regards,
Guillaume
Message was edited by: Guillaume Garcia -
Send mails with csv file as an attachment through oracle(SQL SCripts / Stor
Hello Everybody,
I have recently come across a requirement in which I am supposed to send mails with csv file as an attachment through oracle(SQL SCripts / Stored Procedure) .
The contents of the csv file are to be retreived from the Database as well as the content of the mail and to whom it needs to be sent has also to be picked up from the database.
Can somebody suggest me with a suitable code for the same?
Would be of great help..!!
Thanks & Regards,
- VR
Edited by: user646716 on Dec 18, 2009 10:44 AMread below links
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805
http://www.orafaq.com/wiki/Send_mail_from_PL/SQL#Send_mail_with_UTL_TCP_-withattachments
How to send csv file as an attachment -
Send PO Mail with PDF File that Chinese character doestn't display
Send PO Mail with PDF File that Chinese character doestn't display.
I am using RSTXPDFT4, unicode ECC6.0
Some computer Adobe Reader can read the file, but some computer cannot read, just a blank page.
Thanks.Hi
I worked for one client-chinese where we have to print chinese & english ( bilingual).You need to have dricer program which could identify both scripts .You are right ( unicode0
Please check for the driver program : TWPDF : PDF converter Chinese in SPAD setting.
SAP note is available.I will check and let you update .
Edited by: sunny on Oct 28, 2009 10:29 AM -
Send PO Mail with PDF File that Chinese character doestn't display correctl
Send PO Mail with PDF File that Chinese character doestn't display !
I am using RSTXPDFT4 , tried different computer, some Adobe Reader can read
some are Blank .......
why ?Hi,
那不是要每一台 PC 如果看不到中文就要更新 ?
如果用戶不懂, 那就不是永遠看不見 ? 因為那是供應商嗎 ! -
How to send the mail with multiple file attachments ?
Sending mails with multiple files as attachments.
You need to start from the app, assuming that it has an email function, that contains the files that you want to send as attachments. The Photos app allows you to send up to 5 photos on the same email, but if you want to send multiple file types then you need an app that supports all those file types. I use the GoodReader app which supports quite a few document/file types (e.g. PDF, Excel, Word, pictures), and from that I can select multiple files (including different types) and attach them to the same email.
-
Problem when trying to send a mail with pdf file attached
When I use this features from Adobe reader, a new mail is opened with pdf file but my Outlook signature is not set automatically. Note that all is right configure in Outlook 2007 for the signature option...
Do you have a solution for this problem ?someone else reported this (unless it was you) You'll have to insert your sig manually.
-
What is the best way to send auto mail with excel(generated by query) attachment?
Hello,
Need to generate first data from stored procedure and the save it to an excel file and then send mail with the same excel file.
So am searching for the best way so that i could do all process in a single task with daily or monthly schedule.
As per my understanding, we could it via SSIS and by sql server using
sp_send_dbmail.
But i have to generate excel file first by stored procedure and then end it by mail.
So please suggest the best way to accomplish all task in a single task.
Thanks
AjayHi Ajay,
As shown in the blog mentioned by Syed, to delete records from the Excel file, you need to use Update OpenRowset command to update the corresponding rows to blank.
Alternatively, you can also use Derived Column Transformation or Conditional Split Transformation after the OLE DB Source so that you can replace the target rows with NULL before exporting to Excel destination or just redirect the expected records to the
Excel destination.
Then, in the Control Flow, you can add a Send Mail Task to send the Excel file by setting it as the attachment. The following screenshot is for your reference:
Regards,
Mike Yin
TechNet Community Support -
Send e-mail with a file as attachment - Break line problems
Hi
I use the function SO_NEW_DOCUMENT_ATT_SEND_API1 to send an e-mail from ABAP program.
With SAP4.5B, all work good, but since we have 4.6C, the attached file is malformatted.
An automatic CRLF break line is generated all 1022 char!
The eattachment is create from content of internal table with a line of 255 char.
How can I avoid the automatic CRLF char or how can I to send a good file ?
ThankHi,
look here:
Re: How to email an attachment with more than 255 characters?
Andreas -
Xml file to mail scenario with zip file as an attachment
Hi experts,
I have a file to mail scenario. File is in xml format.
At receiver side, first I want to zip this file and send the zip file as an attachment using mail adapter.
How can i achieve this?
Regards
DiviaHi Shabarish,
In the module tab i have specified the below beans
localejbs/AF_Modules/MessageTransformBean contentType
AF_Modules/PayloadZipBean zip
sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean mail
In the module configuration i mentioned as
Transform.ContentDescription file
Transform.ContentDisposition attachment:filename="file.xml"
zip.filenameKey contentType
zip.mode zipOne
Now i am getting the mail with zip file as an attachment.But the name of the attachment i got is MainDocument.zip
Even the file name inside the zip is MainDocument.xml.
How can i specify my own file name for both zip file and the file inside the archieve folder.Please help me.
Regards
Divia -
Hello ,
i have an IMAC with OSX10.9 , Safari 7.0 and a mail gmail , so it is impossible to send a mail by apple mail with a file attachment ( ex pages ) , no probeme without file
this problem began yesterday
thank you for your helpWe need to know more about your system, please download EtreCheck and run the report and please post it on your next reply. Then we can see how your system is configured, what apps are on it and look for anything obvious. We will look forward to seeing your report.
-
We want to send a mail with attachment pdf file.
Hi!!!
We want to send a mail with attachment pdf file.
The PDF file this is in the server sap.Hi,
Pls check web logs like
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d! -
Send a mail with attached file .xls but i got file without
i tried to send a mail with attached file .xls. but i am able to send the file , we recived the file without file name. please do the same
thnaks in advance.
END-OF-SELECTION.
Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Example .xls documnet attachment'
'XLS'
'filename'
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM DATA_RETRIEVAL.
SELECT EBELN EBELP AEDAT MATNR
UP TO 10 ROWS
FROM EKPO
INTO TABLE IT_EKPO.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM BUILD_XLS_DATA_TABLE.
CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
CON_TAB TYPE X VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO IT_ATTACH SEPARATED BY ''.
CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
LOOP AT IT_EKPO INTO WA_CHAREKPO.
CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
INTO IT_ATTACH SEPARATED BY ''.
CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_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.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
FORM POPULATE_EMAIL_MESSAGE_BODY.
REFRESH IT_MESSAGE.
IT_MESSAGE = 'Please find attached a list test ekpo records'.
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODYPERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Failed IDOC Analysis report'(020)
'xls'(021)
'IDOC_REP'(022)
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDFORM. " F_MAIL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM BUILD_XLS_DATA_TABLE.
*CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
*CON_TAB TYPE X VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE text-040 text-041 text-042 text-043 text-044 text-045 text-046 text-047 text-048 text-049
INTO IT_ATTACH SEPARATED BY con_tab.
CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
clear IT_ATTACH.
loop at i_final_t into w_final.
CONCATENATE
w_final-mestyp w_final-docnum w_final-statxt w_final-msgno w_final-rvplant w_final-kunnr w_final-vbeln w_final-credat
w_final-cretim w_final-flag INTO IT_ATTACH SEPARATED BY con_tab.
CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
clear IT_attach.
endloop.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_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.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM. "SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
FORM POPULATE_EMAIL_MESSAGE_BODY.
data: l1(99) type c,
l2(15) type c,
lt_message type standard table of solisti1,
ls_message like line of lt_message.
clear ls_message.
l1 = 'Dear'(007).
l2 = 'Sir/Madam'(008).
concatenate l1 l2 ',' into
ls_message-line separated by space.
append ls_message to lt_message.
*insert Blank Line
clear ls_message.
ls_message-line = space.
append ls_message to lt_message.
*Assign Message text
clear ls_message.
concatenate text-011
text-012
into ls_message-line separated by space.
append ls_message to lt_message.
*insert Blank Line
clear ls_message.
ls_message-line = space.
append ls_message to lt_message.
*Assign Message text
clear ls_message.
concatenate text-013
text-014
text-015
into ls_message-line separated by space.
append ls_message to lt_message.
concatenate text-016
text-017
into ls_message-line separated by space.
append ls_message to lt_message.
*insert Blank Line
clear ls_message.
ls_message-line = space.
append ls_message to lt_message.
ls_message-line = text-018.
append ls_message to lt_message.
ls_message-line = text-019.
append ls_message to lt_message.
clear: ls_message.
REFRESH IT_MESSAGE.
it_message[] = lt_message[].
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY -
Procedure or Function that send E-mail with image background and file attached
hi
I4d like know if someone there is a procedure or function that send E-mail with image background and file attached, for me.
thanks
Josi VieiraIf you go to this part of OTN you will find the official Oracle UTL_SMTP demo, which includes attachments:
http://technet.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
Getting a background is slightly trickier. The UTL_SMTP package is for primarily sending text e-mails, whereas images require HTML e-mail. I suggest you look at the structure of a sample HTML e-mail and see if you can write the necessary HTML strings in the DATA parameter. Otherwise you'll need to investigate handcrafting a program based on the UTL_TCP package.
[rant]
If this seems like a lot of trouble I agree and urge you not to bother. HTML e-mail is one of the curses of the modern age, not least because it is frequently used by purveyors of viruses. I have a filter on my Outlook client that strips out all the HTML in any e-mail I receive, which means I get lots of e-mails rendered unreadable by the inclusion of <HTML> tags. But who cares, they're mostly spam anyway. In fact, the use of HTML in an e-mail is almost always an indicator of the irrelevance of its content.
[rant]
Vibes, APC -
Send a mail with the class CL_HTTP_CLIENT
hi,
i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
Thank you.
*& Report ZYTEST_TRANSFER_URL2 *
REPORT zytest_transfer_url2 .
*- begin of internal data
TYPE-POOLS: swfxc, icon.
DATA: l_http_client TYPE REF TO if_http_client.
DATA: l_url TYPE string.
DATA: l_code TYPE sy-subrc.
DATA: l_code_string TYPE string.
DATA: l_message_string TYPE string.
DATA: lt_http_fields TYPE tihttpnvp.
DATA: l_http_field_wa TYPE ihttpnvp.
DATA: l_char_header(40) TYPE c.
DATA: l_body_string TYPE string.
DATA : line TYPE string.
DATA: result_tab TYPE TABLE OF string,
result_str TYPE string.
*- end of internal data
DATA: lv_contents TYPE string.
DATA: lv_location TYPE string.
*- begin of parameters
PARAMETERS: url TYPE swc_value.
PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
*- end of parameters
START-OF-SELECTION.
PERFORM main.
*& Form main
text
FORM main.
PERFORM get_contents USING lv_contents.
*- Create the HTTP-Client
l_url = url.
l_proxy_host =
l_proxy_service =
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = l_url
proxy_host = l_proxy_host
proxy_service = l_proxy_service
IMPORTING
client = l_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*- send the http post
CALL METHOD l_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Send: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- receive the result of http post
CALL METHOD l_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Receive: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- print the results
CALL METHOD l_http_client->response->get_status
IMPORTING
code = l_code.
IF l_code < 300.
HTTP-codes: 100 - 199 = informations
HTTP-codes: 200 - 299 = client-request successful (200 = OK)
WRITE: / icon_green_light AS ICON.
ELSE.
HTTP-codes: 300 - 399 = redirected; further actions required
HTTP-codes: 400 - 499 = client-request incomplete
HTTP-codes: 500 - 599 = server errors
WRITE: / icon_red_light AS ICON.
ENDIF.
*-- get the http header fields
CALL METHOD l_http_client->response->get_header_fields
CHANGING
fields = lt_http_fields.
LOOP AT lt_http_fields INTO l_http_field_wa.
l_char_header = l_http_field_wa-name.
WRITE: / l_char_header.
l_char_header = l_http_field_wa-value.
WRITE: l_char_header.
ENDLOOP.
WRITE: / sy-uline.
*- get the body
DATA: lv_bin_contents TYPE xstring.
lv_bin_contents = l_http_client->response->get_data( ).
PERFORM save_file USING lv_bin_contents.
ENDFORM. "main
*& Form print_string
FORM print_string USING p_string TYPE string.
REFRESH result_tab.
SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
LOOP AT result_tab INTO result_str.
WRITE:/ result_str.
ENDLOOP.
ENDFORM. " print_string
*& Form save_file
text
FORM save_file USING lv_bin_contents.
DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
DATA: lv_file TYPE localfile.
DATA : g_file(80).
g_file = url.
DO.
SHIFT g_file LEFT UP TO '/'.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SHIFT g_file LEFT.
ENDDO.
SHIFT g_file RIGHT UP TO '.'.
SHIFT g_file RIGHT.
lv_file = save_file.
OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
WRITE:'SY-SUBRC :',sy-subrc.
MESSAGE i000 WITH text-014. "'File Directory not found'.
EXIT.
ENDIF.
TRANSFER lv_bin_contents TO lv_file.
CLOSE DATASET lv_file.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE i000 WITH text-012."'Successfully downloaded to Application
server'.
EXIT.
ENDIF.
ENDFORM. "save_filehi,
i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
Thank you.
*& Report ZYTEST_TRANSFER_URL2 *
REPORT zytest_transfer_url2 .
*- begin of internal data
TYPE-POOLS: swfxc, icon.
DATA: l_http_client TYPE REF TO if_http_client.
DATA: l_url TYPE string.
DATA: l_code TYPE sy-subrc.
DATA: l_code_string TYPE string.
DATA: l_message_string TYPE string.
DATA: lt_http_fields TYPE tihttpnvp.
DATA: l_http_field_wa TYPE ihttpnvp.
DATA: l_char_header(40) TYPE c.
DATA: l_body_string TYPE string.
DATA : line TYPE string.
DATA: result_tab TYPE TABLE OF string,
result_str TYPE string.
*- end of internal data
DATA: lv_contents TYPE string.
DATA: lv_location TYPE string.
*- begin of parameters
PARAMETERS: url TYPE swc_value.
PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
*- end of parameters
START-OF-SELECTION.
PERFORM main.
*& Form main
text
FORM main.
PERFORM get_contents USING lv_contents.
*- Create the HTTP-Client
l_url = url.
l_proxy_host =
l_proxy_service =
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = l_url
proxy_host = l_proxy_host
proxy_service = l_proxy_service
IMPORTING
client = l_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*- send the http post
CALL METHOD l_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Send: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- receive the result of http post
CALL METHOD l_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Receive: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- print the results
CALL METHOD l_http_client->response->get_status
IMPORTING
code = l_code.
IF l_code < 300.
HTTP-codes: 100 - 199 = informations
HTTP-codes: 200 - 299 = client-request successful (200 = OK)
WRITE: / icon_green_light AS ICON.
ELSE.
HTTP-codes: 300 - 399 = redirected; further actions required
HTTP-codes: 400 - 499 = client-request incomplete
HTTP-codes: 500 - 599 = server errors
WRITE: / icon_red_light AS ICON.
ENDIF.
*-- get the http header fields
CALL METHOD l_http_client->response->get_header_fields
CHANGING
fields = lt_http_fields.
LOOP AT lt_http_fields INTO l_http_field_wa.
l_char_header = l_http_field_wa-name.
WRITE: / l_char_header.
l_char_header = l_http_field_wa-value.
WRITE: l_char_header.
ENDLOOP.
WRITE: / sy-uline.
*- get the body
DATA: lv_bin_contents TYPE xstring.
lv_bin_contents = l_http_client->response->get_data( ).
PERFORM save_file USING lv_bin_contents.
ENDFORM. "main
*& Form print_string
FORM print_string USING p_string TYPE string.
REFRESH result_tab.
SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
LOOP AT result_tab INTO result_str.
WRITE:/ result_str.
ENDLOOP.
ENDFORM. " print_string
*& Form save_file
text
FORM save_file USING lv_bin_contents.
DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
DATA: lv_file TYPE localfile.
DATA : g_file(80).
g_file = url.
DO.
SHIFT g_file LEFT UP TO '/'.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SHIFT g_file LEFT.
ENDDO.
SHIFT g_file RIGHT UP TO '.'.
SHIFT g_file RIGHT.
lv_file = save_file.
OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
WRITE:'SY-SUBRC :',sy-subrc.
MESSAGE i000 WITH text-014. "'File Directory not found'.
EXIT.
ENDIF.
TRANSFER lv_bin_contents TO lv_file.
CLOSE DATASET lv_file.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE i000 WITH text-012."'Successfully downloaded to Application
server'.
EXIT.
ENDIF.
ENDFORM. "save_file
Maybe you are looking for
-
My question is how to implement FrameBorderLayout tag in oracle adf? Please answer this by using an example.
-
Sending message while order get Pending Status
Hi, We r using status profile for releasing order. If order fails the condition, it remains in the Pending Status. So we need to send these order to Sales Rep for review. How to send email to Sales Rep?
-
Exporting to JPG = Losing EXIF
Hello guys, i really hope someone can help me out. I confess this problem is really annoying me. First of all, I have an Acer aspire Notebook 5750 – 8GB RAM – Windows 7 Home Basic 64b And a Lightroom 3.4.1 64bits as well. My camera is a Nikon D3100.
-
Client side: is it safe to add a line to NFS StartupItem for a mount?
(posted this on tiger client board, but realized that this is actually a better forum for this) I need to mount an nfs share at boot on my clients. I dont want to use fstab, because I need a specific mount location (dont want it to add the /private/N
-
Nokia 7370, No Network Access?
Hi, Wondering if anyone could help please? Just won a Nokia 7370 of Club Nokia a few week ago and it was working fine up to a few days ago. I am on O2 but all of a sudden i have no network access. My sim card is not at fault as it works in my old 514