Launch MS outlook with attachment in email
working on jdk 1.5 need to launch MS outlook with new email having attachment with it. here is the code i have written for the same. The code opens the MS outlook but i am not able to attach the file with the same. any ideas how to proceed for the same?
try {
String stLineSep; // String containing the system line separator
// Line separator:
stLineSep = System.getProperty("line.separator"); // Get it
Runtime.getRuntime().exec(
new String[] {"rundll32",
"url.dll,FileProtocolHandler",
"mailto:" + "&attachment=" + "c:\\rohit.txt"}
);//","attachment;filename="+strFileName
catch (Exception ex) {
ex.printStackTrace();
Thanks,
rdh
try {
String stLineSep; // String containing the system line separator
// Line separator:
stLineSep = System.getProperty("line.separator"); // Get it
Runtime.getRuntime().exec(
new String[] {"rundll32",
"url.dll,FileProtocolHandler",
"mailto:" + "&attachment=" + "c:\\rohit.txt"}
);//","attachment;filename="+strFileName
catch (Exception ex) {
ex.printStackTrace();
}
Similar Messages
-
Logging into outlook with an apple email address
i have a windows laptop but I want to log into outlook with my apple email adress and it is asking for my outgoing and incoming email server in order to do this. I dont know what i meant to put exactly is there anyway you can help?
Hello eharding
Download the iCloud Control Panel; it will automatically setup iCloud email for you as well as other syncing other options.
iCloud Control Panel 3.0 for Windows
http://support.apple.com/kb/dl1455
Regards,
-Norm G. -
Acrobat 9.4 / Outlook 2011 – Attach to email not working
Acrobat 9.4 / Outlook 2011 / OS 10.6.4
I am having a very annoying issue with the "Attach to email" feature in Acrobat 9.4. I keep getting the error below every time I try using this feature. I don't have the same problem if use/switch the email client Mail from Apple. Just wondering if this is an Adobe issue or a Microsoft issue.
Thank you,Yes at one time Acrobat only supported Entourage, a ver obscure program called Mailsmith, and Eudora, and Apple Mail. (Eudora was taken over by Mozilla Or rather the R&D for it was handed over to Mozilla.)
Yet most everyone on apple side of equation use ThunderBird, SeaMonkey, Even Opera. the message I receive is That Seamonkey or Thunderbird doesn't know how to talk to your email clent. Yet in their specifications Mozilla products show they are Mbox compliant.
On PC side they will talk to just about any Email except Mozilla Products. Its as if they put in features yet don't support software that can handle the features so most people are stuck un able to use the fetaures. Why can't Adobe get along with other software vendors. Is there Software Devopment staff so out of touch or have such a low skill set That they don't know how to write code but those name applications?
I put a Bug report for support of Mozilla Products for uears do it about once or twice a year for last 10 years or so. Goes in one ear and out the other. -
Adobe X opens only Outlook when attaching as email?
Is there a way to make Adobe X use a person's default mail client instead of only Outlook? Our organization uses primarily Thunderbird. When viewing a PDF and choosing File > Attach to Email (or clicking the envelope toolbar button), Abobe X attempts to use Outlook, which is either not available on our clients' PCs, or not configured for email at all.
Thank you.This possible has to do with a wrong MAPS setting in your OS.
You have to configure which app uses the mailTo protocol per default.
http://help.adobe.com/en_US/Acrobat/9.0/Standard/WS571A8F2F-B971-435c-9FD3-E6789CCAFFFC.w. html -
Launch MS OutLook with parameters
I have written the ff code to launch MS Outlook. I want to pass it the ff parameters: subject and body.
String[] mailDet = {"cmd","/c","start","mailto:?subject=hello?body=test"};
Process mailClient = Runtime.getRuntime().exec(mailDet);My problem is 2 fold.
1. The body field is NOT set with the 'test' string.
2. If I take out the subject parameter and just have
"mailto:?body=test message" the body is initialised with ONLY 'test' and ignores anything after the white space.
Any help on both issues much appreciated.
Agent!Regarding your 1st issue:
Wouldn't you want
mailto:[email protected]?subject='Test%20Message'&Body='This%20is%20A%20Test -
Email with attachement - only email arrieves, no attachement ?
hi there,
when i sent out emails (either with standard transaction S00 or with abap) with attachement (pdf, word, etc..........) there are SOME customers which ONLY receive the email without the attachement.
from about 250 mails we send out this way, about 5 or 6 have this strange behaviour.
do you know if some anti-virus-software have problems with email coming directly from sap ?????
reg, MartinHi martin,
I had a code snippet for the attachment.
Try it out.
Regards,
Vivek.
Reward points if it helps.
Create attachment notification
CLEAR t_packing_list.
t_packing_list-doc_size = ( w_cnt_attach - 1 ) * 255 +
STRLEN( it_attach ).
t_packing_list-transf_bin = ' '.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = w_cnt_message + 1.
t_packing_list-body_num = w_cnt_attach.
t_packing_list-doc_type = 'xls'.
t_packing_list-obj_descr = 'Vendor Info'.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = p_receiver.
t_receivers-rec_type = 'U'.
APPEND t_receivers.
append lines of it_attach to it_message.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = P_sender
sender_address_type = 'INT'
sender_address_type = 'SMTP'
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin =
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. -
Email from ABAP program to outlook with attachment
Hi,
I need to send an email to outlook from my program with an attachment. I wrote my program without attchment feature and working fine. I really donot understand how to do attchment. Can anyone send me some piece of code.
I promise points will be rewarded for useful answers.
Thanks In Advance.
Rajesh.Here is a sample program how to attach a sapscript output to your email.
REPORT ZRICH_0003.
DATA: ITCPO LIKE ITCPO,
TAB_LINES LIKE SY-TABIX.
* Variables for EMAIL functionality
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
PERFORM SEND_FORM_VIA_EMAIL.
* FORM SEND_FORM_VIA_EMAIL *
FORM SEND_FORM_VIA_EMAIL.
CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
* Creation of the document to be sent File Name
MAILDATA-OBJ_NAME = 'TEST'.
* Mail Subject
MAILDATA-OBJ_DESCR = 'Subject'.
* Mail Contents
MAILTXT-LINE = 'Here is your file'.
APPEND MAILTXT.
* Prepare Packing List
PERFORM PREPARE_PACKING_LIST.
* Set recipient - email address here!!!
MAILREC-RECEIVER = '[email protected]'.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = ' '
TABLES
PACKING_LIST = MAILPACK
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
ENDFORM.
* Form PREPARE_PACKING_LIST
FORM PREPARE_PACKING_LIST.
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.
* Creation of the document attachment
* This form gets the OTF code from the SAPscript form.
* If you already have your OTF code, I believe that you may
* be able to skip this form. just do the following code, looping thru
* your SOLISTI1 and updating MAILBIN.
PERFORM GET_OTF_CODE.
LOOP AT SOLISTI1.
MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
APPEND MAILBIN.
ENDLOOP.
DESCRIBE TABLE MAILBIN LINES TAB_LINES.
MAILHEAD = 'TEST.OTF'.
APPEND MAILHEAD.
** Creation of the entry for the compressed attachment
MAILPACK-TRANSF_BIN = 'X'.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 1.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'OTF'.
MAILPACK-OBJ_NAME = 'TEST'.
MAILPACK-OBJ_DESCR = 'Subject'.
MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND MAILPACK.
ENDFORM.
* Form GET_OTF_CODE
FORM GET_OTF_CODE.
DATA: BEGIN OF OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTF.
DATA: ITCPO LIKE ITCPO.
DATA: ITCPP LIKE ITCPP.
CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.
* Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_FORM'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
DIALOG = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
* Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
MOVE-CORRESPONDING ITCPO TO ITCPP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = ITCPP
TABLES
OTFDATA = OTF
EXCEPTIONS
OTHERS = 1.
* Move OTF code to structure SOLI form email
CLEAR SOLISTI1. REFRESH SOLISTI1.
LOOP AT OTF.
SOLISTI1-LINE = OTF.
APPEND SOLISTI1.
ENDLOOP.
ENDFORM.
Regards,
Rich Heilman -
TS3276 Outgoing Mail with attachment loses email content. Why
Sometimes (only a few times) if I send an attachment with an email, the recipient does not receive the content of my email. The attachment is received but the email content is blank. Has anyone else experienced this? Any ideas how to overcome it?
thanks dude.
first fall you people forgive me for cross posting
mailing
i got answer here. anyways. thanks helping. -
Adobe "attach as email" operation with Outlook set as default client.
Case 1:
I have adobe reader installed and have multiple outlook profiles. Outlook is closed and now i perform "attach to email" operation from adobe, choose profile dialog is not displayed and email is sent from default profile account.
Case 2:
Start Outlook and choose a profile to log on. After launching outlook, perform "attach to email" operation from adobe. Compose message window is display and send, message goes out. Message goes out from the account of default profile.
In Case 1, Other applications like mspaint and winword, user is prompted to choose profile.
In Case 2, email goes out from the profile from which user is logged onto the Outlook.
I wanted to know about above observations and whether it is expected behaviour with adobe or a bug?Not sure but this might be a Windows Control Panel Issue.
-
Problem in opening the Out look with attachment.
Hi All
I have requirement in WEb Dynpro that need to open MicroSoft OUTLOOK with attachment.
Can you please help me in this.
Thanks
RamaHi Rama,
I know only one way of an attachment with Outlook open. There are command-line parameters in Outlook.
Here is an example: "C: \ Program Files \ Microsoft Office \ Office11 \ Outlook.exe / a" C: \ My Documents \ labels.doc "/ c ipm.note
I hope I could help.
Best regards
Bettina -
Outlook with Activesync?
I recently obtained an Macbook Air and I am trying to connect Outlook with my corporate email.
My IT manager told me I could not use IMAP or POP but had to use Active Sync.
When I setup a new Account my choices are Exchange or Email (which leads me to IMAP/POP) so I assume my only choice is Exchange.
I entered the same information for the Exchange account that I have on my Android phone and table ActiveSync accounts - same email, authentication method, username, password. But when I ever I hit "Send/Receive" in Outlook nothing happens. I don't get any error messages or anything saying try it is trying to sync.
Am I missing somethinng? I am connected to valid Wi-Fi connection. I am not on the VPN, but I am not on my Android devices either so I don't think that is the issue. Do I need to enable something? Am I msising a setting somewhere?
Thanks in advance for the help.It's going to be difficult to pin down exactly what the problem is but at least it sounds like you're on the right track. Your screen looks like this, correct:
The email address field is self explanatory but the Method, User name, Password and Server is going to vary significantly between users. For example the Exchange environment that I support now requires the username to look like this: AD3\username. However a sister department of ours who runs on the same Exchange box does not require the AD3\ prefix and they use a different server.
It seems unlikely that you'd require a VPN for your Exchange email, most modern Exchange deployments have a forward facing server address that allows incoming, non-corporate VLAN IP addresses access. The fact that your Android phone can connect would support that your Exchange environment supports that as well. You indicated that you've entered the same credentials but you make no mention of that server field, I suspect that's the issue here. If you're not sure what that information is you can contact your IT for that and hopefully it'll resolve the issue. -
I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with %20 - how can I change this?
Click on the below link :
https://get.adobe.com/flashplayer/otherversions/
Step 1: select Mac OS X 10.6-`0.`0
Step 2 : Safari and FIrefox
Then click on " Download Now" button. -
"Attach to Email" option launches outlook rather than default mail client
The "Attach to Email" option luanches outlook rather than Seamonkey, which is set to be the default mail client. Any ideas regrding fixing this would be most appreciated. This is Adobe Acrobat 9 PRO v. 9.0.0 running on a 64 bit Windows 7 Home Premium 4.0 GB machine.
Thanks,Not sure but this might be a Windows Control Panel Issue.
-
When sending an email using outlook can you attach another email?
When sending a new email using outlook, is it possible to attach another email?
What does that have to do with iPhones?
-
Problem by Sending an Email with attached Adobe Interactive Form (Code)
Thanks. I have written Programm, but it does not work as i want it to do. I will send an Email with attached Adobe Interactive Firm to [email protected]. I tried it with "*lo_recipient = cl_sapuser_bcs=>create( sy-uname )" at the marked(bold, fat) position. It worked but the Email was send to my SAP-Account, but i want to send to [email protected], so I tried this (see at code in bold, fat):
lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
But it doens`t send the email.
Can anybody help me please???
Kevin
Here my Code:
Report FP_EXAMPLE_01
Printing of documents using PDF based forms
REPORT z_example_02.
Data declaration
DATA: carr_id TYPE sbook-carrid,
customer TYPE scustom,
bookings TYPE ty_bookings,
connections TYPE ty_connections,
fm_name TYPE rs38l_fnam,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
error_string TYPE string,
l_booking TYPE sbook,
t_sums TYPE TABLE OF sbook,
l_sums LIKE LINE OF t_sums,
fp_formoutput TYPE fpformoutput.
PARAMETER: p_custid TYPE scustom-id DEFAULT 38.
SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.
PARAMETER: p_form TYPE tdsfname DEFAULT 'FP_EXAMPLE_01'.
PARAMETER: language TYPE sfpdocparams-langu DEFAULT 'E'.
PARAMETER: country TYPE sfpdocparams-country DEFAULT 'US'.
Get data from the following tables: scustom(Flight customer)
sbook (Single flight reservation)
spfli (Flight plan)
SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
CHECK sy-subrc = 0.
SELECT * FROM sbook INTO TABLE bookings
WHERE customid = p_custid
AND carrid IN s_carrid
ORDER BY PRIMARY KEY.
SELECT * FROM spfli INTO TABLE connections
FOR ALL ENTRIES IN bookings
WHERE carrid = bookings-carrid
AND connid = bookings-connid
ORDER BY PRIMARY KEY.
Print data:
First get name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = p_form
IMPORTING
e_funcname = fm_name.
IF sy-subrc <> 0.
MESSAGE e001(fp_example).
ENDIF.
Set output parameters and open spool job
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
Set form language and country (->form locale)
fp_docparams-langu = language.
fp_docparams-country = country.
*fp_docparams-fillable = 'X'.
*fp_docparams-langu = 'E'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
*fp_docparams-country = 'GB'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
currency key dependant summing
LOOP AT bookings INTO l_booking.
l_sums-forcuram = l_booking-forcuram.
l_sums-forcurkey = l_booking-forcurkey.
COLLECT l_sums INTO t_sums.
ENDLOOP.
Now call the generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
customer = customer
bookings = bookings
connections = connections
t_sums = t_sums
IMPORTING
/1bcdwb/formoutput = fp_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
IMPORTING
e_adserrstr = error_string.
IF NOT error_string IS INITIAL.
we received a detailed error description
WRITE:/ error_string.
EXIT.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Close spool job
CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_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.
*********************Send the form*******************
*********************to the Customer*****************
*********************via Email***********************
*IF i_down = abap_true.
DATA: filename TYPE string,
path TYPE string,
fullpath TYPE string,
default_extension TYPE string VALUE 'PDF'.
Data:
lt_att_content_hex TYPE solix_tab.
*DATA: data_tab TYPE TABLE OF x255.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_formoutput-pdf
TABLES
binary_tab = lt_att_content_hex.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL.
DATA: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear Vendor,' TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Please fill the attached form and send it back to us.'
TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Vendor Payment Form' ).
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Vendor Payment Form'
i_att_content_hex = lt_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
lo_send_request->set_document( lo_document ).
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
lo_send TYPE adr6-smtp_addr VALUE '[email protected]'. "Absender SENDER
lo_sender = cl_cam_address_bcs=>create_internet_address( lo_send ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
Create recipient
DATA:
lo_recipient type ref to if_recipient_bcs value is initial.
Data:
lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
*lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
*lo_send_request->add_recipient(
*EXPORTING
*i_recipient = lo_recipient
*i_express = 'X' ).
Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
MESSAGE 'The payment form has been emailed to the Vendor' TYPE 'I'.Hi Kevin,
Please try this code to send your mail, i wrote it and works well in many system.
Take care if in your profile you got an e-mail adress define .
Take care also of trnasaction SCOT customizing, are you able to send mail to e-mail adress ?
Let me know if it's works.
Best regards.
<i>**----
CLASS-DEFINITIONS
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
INTERNAL TABLES
DATA: l_mailtext TYPE soli_tab.
DATA: iaddsmtp TYPE TABLE OF bapiadsmtp.
DATA: ireturn TYPE TABLE OF bapiret2.
VARIABLES
DATA: mail_line LIKE LINE OF l_mailtext.
DATA: bapiadsmtp TYPE bapiadsmtp.
DATA: subject TYPE so_obj_des.
DATA : att_subject TYPE so_obj_des.
DATA : w_except TYPE REF TO cx_root .
CONSTANTS : c_defmail TYPE ad_smtpadr VALUE
'[email protected]' .
FIELD-SYMBOLS : <smtp> TYPE bapiadsmtp.
*Convert the pdf given by function module into Binary .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = output-pdf "PDF file from function module
TABLES
binary_tab = hexa.
*Set subject of the mail
subject = 'Exemple de PDF interactif'.
Set text of the mail
mail_line = 'Merci de remplir le formulaire et nous le retourner'.
APPEND mail_line TO l_mailtext .
Set the name of the attached document
att_subject = 'Template du PDF'.
TRY.
Create persistent send request
send_request = cl_bcs=>create_persistent( ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
Read the E-Mail address for the user
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
TABLES
return = ireturn
addsmtp = iaddsmtp.
LOOP AT iaddsmtp ASSIGNING <smtp> WHERE std_no = 'X'.
CLEAR bapiadsmtp.
MOVE <smtp> TO bapiadsmtp.
ENDLOOP.
CASE bapiadsmtp-e_mail.
WHEN space.
No adress main for user, so send it to the default mail adress
recipient =
cl_cam_address_bcs=>create_internet_address( c_defmail ).
WHEN OTHERS.
recipient =
cl_cam_address_bcs=>create_internet_address( bapiadsmtp-e_mail ).
ENDCASE.
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'
i_copy = space
i_blind_copy = space
i_no_forward = space.
Set that you don't need a Return Status E-mail
CALL METHOD send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'E'.
set send immediately flag
send_request->set_send_immediately( 'X' ).
*Build Document
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_mailtext
i_subject = subject ).
add attachment to document
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = att_subject
i_att_content_hex = hexa.
Add document to send request
CALL METHOD send_request->set_document( document ).
Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_send_req_bcs INTO w_except.
CATCH cx_address_bcs INTO w_except.
CATCH cx_document_bcs INTO w_except.
ENDTRY.</i>
Maybe you are looking for
-
How to Create Roaming Profile(s) For Windows Workgroups
This Tutorial Shows how to create roaming profile(s) for Windows Workgroups. Here are the steps in order to do this: On the host PC: 1. Goto 'Folder Options'>'View' and un-tick 'Use Simple File Sharing'. 2. Goto Network Connections and right click on
-
HT4623 iPad locked up with just apple logo on screen. How to fix?
I've tried the forced reboot (hold sleep buttom and home button at same time), but can't get past a screen with the apple logo. Any ideas? Thanks
-
Infotype Log report: RPUAUD00
Hi, RPUAUD00 is not supporting for some Infotypes. I have configured tables V_T585A, V_T585B and V_T585C, still issue is same. So, Is there any other things need to be configured? Thanks SK
-
Repeatedly, this error code suddenly appears on the screen and I don't have a clue what it means or what to do: "A script in this movie is causing Adobe Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do
-
Zen V Plus support for Office 2007 Supp
Hi All?Anybody heard when the Zen V PLus will have support for Office 2007 to be able to synchronize contacts, etc.Message Edited by stevenvj on 06-20-200703:20 AM