Attach a PDF in SAP mail
I have a PDF document and send as Email using fm SO_NEW_DOCUMENT_ATT_SEND_API1. How do we attach a pdf which is saved on hardisk to sap mail ?
Thanks in advance.
A similar case was handled in the following code.
REPORT Z_SCRIPT .
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 = 'Z08V3_COLLI'
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.
Check it,it may help u.
Regards
Similar Messages
-
Attaching multipage .pdf file in Mail
How do I attach a multipage .pdf file in Mail? I am running OSX 10.8.2 on a MacBook Pro. When I try to attach only the frst page attaches.
Are you sure?
When you add the multi-page attachment to your email only the first page shows. If you click on that first page to select it and then right click and choose Quick Look Attachemnt you should be able to see that all pages are there.
Matt -
Sending INVOICE as attachment in PDF for external Mail address
HI!,
We have made configuraiton for sendin mail while saving VF01 or VF02 from SAP R/3 to external id.
Email is going to the partner Payer but the attachment of the invocie is going as OTF format and not in PDF.
Where i am missing. I have gone thro the discussion thread of srinivas talks about some coding required in Program which what is that
thanks in advanceHi,
Check this program.
Re: send a mail thro abap report
Posted: Mar 14, 2006 11:40 AM Reply E-mail this post
hi,
the below program will help you to send email with any kind of attachment.It is working fine for me.Just try it.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
*PARAMETERS : appfn(150) TYPE c LOWER CASE OBLIGATORY.
DATA : pos TYPE i.
DATA : len TYPE i.
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.
*file_name = appfn.
*OPEN DATASET appfn FOR INPUT IN BINARY MODE.
*DO.
READ DATASET appfn INTO ITAB.
IF SY-SUBRC EQ 0.
*APPEND ITAB.
ELSE.
*APPEND ITAB.
EXIT.
ENDIF.
*ENDDO.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
***INCLUDE ZINCLUDE_01 .
Data
tables crmrfcpar.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
data v_rfcdest LIKE crmrfcpar-rfcdest.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
SELECT SINGLE * FROM crmrfcpar WHERE consumer = 'CRM'.
v_rfcdest = crmrfcpar-rfcdest.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' DESTINATION v_rfcdest
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
FORM
FORM ml_saveforbp USING jobname jobcount.
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*DATA : seqnr TYPE i.
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
FORM
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
ENDFORM. "ml_fetchfrombp
-suresh -
Attaching all PDFs in one mail? Having only one Body
Dear All,
I managed to develop a code which enable me to send a mail for each selected line in my table. The problem is it send to me for each line a separate E-mail "each line has a PDF ". I just want to send only one mail for all PDFs attachments.
Code:
foreach (vw_CustLedgerEntryItem1 item in _ItemsList.SelectedItems)
//you would normally process each row
//but here we're just concatenating the properties as
//proof that we are processing the selected rows
//vw_CustLedgerEntryItem1 entryItem = this.vw_CustLedgerEntry.SelectedItem;
InvSendbyMailRequestBody reqBody = new InvSendbyMailRequestBody(
item.Document_No_
, item.Report_Type
, "DynNavHRS"
, this.Application.User.Name.Replace(@"HRS\", "") + "@hrs.com" // HRS001
, "Document"
, false
, false
, this.vw_CustomerItem.ISO_Code // Change 7.8.2014 Bug in Email body text sprache
, this.vw_CustomerItem.Salesperson_E_mail // Change 7.8.2014 Bug in Send E-mail
, item.Customer_No_.ToString()
, false
, "XYZ"
, false);
InvSendbyMailRequest req = new InvSendbyMailRequest(reqBody);
HRSReportServiceSoapClient wsHRS = new HRSReportServiceSoapClient();
wsHRS.InvSendbyMailAsync(req);
this.ShowMessageBox("Your email was successfully sent");
any idea how can I send the attachment only in one mail ? My guess is that I have to take out this part out of my loop ? but its not working :(
InvSendbyMailRequest req = new InvSendbyMailRequest(reqBody);
HRSReportServiceSoapClient wsHRS = new HRSReportServiceSoapClient();
wsHRS.InvSendbyMailAsync(req);
Thanks a lot,
ZayedHI Zayed,
If you want to send an email with attachments in Lightswitch, you could consider using System.Net.Mail with
Attachment Class. For example:
attachment1 = pathToFirstAttachmentFile;
attachment2 = pathToSecondAttachmentFile;
// create and add first attachment to collection
Attachment data = new Attachment(attachment1, MediaTypeNames.Application.Octet);
m_MailMessage.Attachments.Add(data);
// create and add second attachment to collection
Attachment data2 = new Attachment(attachment2, MediaTypeNames.Application.Octet);
m_MailMessage.Attachments.Add(data
Best regards,
Angie
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to attach a PDF to a mail with document-add_attachment
Hello,
I don't know how to pass the PDF to binary, in order to be able to pass the parameter to the method add_attachment.
Exist any FM? How to make compatible this new binary file with the parameter of the method?
document->add_attachment(
i_attachment_type = 'PDF'
i_attachment_subject = 'attachment'
i_att_content_hex = ???? ).
Thank you,
ManelHi,
Follow example here.
DATA: l_doland1 TYPE char255,
l_doland2 TYPE char255.
Preparing body of the Mail
MOVE 'Please Find the Attached Packlist' TO l_text.
APPEND l_text TO i_content.
Preparing contents of attachment with Change Log
PERFORM prepare_attachment.
Creates persistent send request
TRY.
l_send_request = cl_bcs=>create_persistent( ).
Creating Mail Subject
CONCATENATE '(' 'DO#' vbpla-vbeln INTO l_doland1.
CONCATENATE vbpla-land1 ')' '-' 'Packlist' INTO l_doland2.
CONCATENATE 'PreAlert from ATSG' l_doland1 'TO' l_doland2
INTO l_subject separated by space.
MOVE l_subject TO i_subjec.
Creating Document
l_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = i_content[]
i_subject = i_subjec ).
Size of PDF Document
l_size = l_byte_count.
Adding Attachment
CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type = c_ext
i_attachment_size = l_size
i_attachment_subject = 'Packing List'
i_att_content_hex = i_attachx[].
Add document to send request
CALL METHOD l_send_request->set_document( l_document ).
Get Sender Object
l_uname = sy-uname.
l_sender = cl_sapuser_bcs=>create( l_uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
E-Mail
SELECT * FROM zsdshpalertlist INTO TABLE email_list
WHERE kunnr = vbpla-kunwe.
LOOP AT email_list.
CHECK NOT email_list-email IS INITIAL.
ld_email = email_list-email.
l_recipient = cl_cam_address_bcs=>create_internet_address( ld_email ).
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'U'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
ENDLOOP.
*Trigger E-Mail immediately
l_send_request->set_send_immediately( 'X' ).
CALL METHOD l_send_request->send( ).
COMMIT WORK.
CATCH cx_document_bcs INTO l_bcs_exception.
CATCH cx_send_req_bcs INTO l_send_exception.
CATCH cx_address_bcs INTO l_addr_exception.
ENDTRY.
FORM prepare_attachment .
DATA: wa_pdf TYPE tline,
wa_attachx TYPE solix,
l_pdf_len TYPE i,
l_con_len TYPE i,
l_pdf_pos TYPE i,
l_con_pos TYPE i,
l_spool_size TYPE sood-objlen.
FIELD-SYMBOLS: <fs_con> TYPE x.
l_con_pos = 0.
DESCRIBE FIELD wa_pdf LENGTH l_pdf_len IN BYTE MODE.
DESCRIBE FIELD wa_attachx LENGTH l_con_len IN BYTE MODE.
LOOP AT i_pdf INTO wa_pdf.
ASSIGN wa_pdf TO <fs_con> CASTING.
CHECK sy-subrc EQ 0.
DO l_pdf_len TIMES.
l_pdf_pos = sy-index - 1.
IF l_con_pos = l_con_len.
APPEND wa_attachx TO i_attachx.
FREE wa_attachx.
l_con_pos = 0.
ENDIF.
MOVE <fs_con>l_pdf_pos(1) TO wa_attachx-linel_con_pos(1).
ADD 1 TO l_con_pos.
ENDDO.
ENDLOOP.
IF l_con_pos > 0.
APPEND wa_attachx TO i_attachx.
ENDIF.
ENDFORM. -
Title says it all. I go to attach file add the fild and the first page shows up in the body of the email. How do I get the whole document to show up?
You can't get the whole document to appear on your side.
When you send it, the entire document will be sent. Normally, clicking on it will open it in preview where you can see all pages. If you want to see it in this way, just cc: or bcc: yourself on the email when you send it. -
How to attach Multiple attachments to single mail
How to attach multiple pdfs to single mail ?
or
how to attach one pdf & One excel & One word document to single mail ?
Thanks In AdvanceHello Karunya,
Please refer to the link below.
https://wiki.sdn.sap.com/wiki/display/Snippets/Send%20email%20with%20multiple%20zipped%20attachments
Regards,
P Bansal -
PDF's in Mail Not Previewing Properly - All Text is small Boxes with "X"'s
Hi, when I attach a .pdf file in Mail the letters of the fonts sow up as small boxes with an "X" in the middle. I have attached PDF's before with no problems viewing them in Mail but now they are unreadable.
I contacted Adobe but the PDF looks fine in other applications. I also open the file and save it using "Preview" and it looks fine until I attach it in an email then the font letters are all boxes with "X" in the middle.
Please Help!Do a backup, using either Time Machine or a cloning program, to ensure files/data can be recovered. Two backups are better than one.
Try setting up another admin user account to see if the same problem continues. If Back-to-My Mac is selected in System Preferences, the Guest account will not work. The intent is to see if it is specific to one account or a system wide problem. This account can be deleted later.
Isolating an issue by using another user account
Try booting into the Safe Mode using your normal account. Disconnect all peripherals except those needed for the test. Shut down the computer and then power it back up after waiting 10 seconds. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear and again when you log in. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. When you reboot normally, the initial reboot may be slower than normal. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application un-installer. For each disable/delete, you will need to restart if you don’t do them all at once.
Safe Mode - Yosemite
Safe Mode - About -
Send PDF Attachment to SAP Mail Inbox.
Dear all,
I have problem please help me out.
i have to create an PDF file with
my own data and that created PDF file
i have to send it to SAP mail inbox
(Transaction code : so01).hi sudheer,
Let the data be populated into ur itab ,
Now in the code just concentrate on
Perform fill structure.
the process u need to do is from ur layout convert from
itab o/p format itab>OTF/OTF->PDF .
see the function modules .
on execution of this a mail will be in ur outbox .
regards,
vijay.
tables : vbak.
type-pools:slis.
data: begin of it_t1 occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam like vbak-ernam,
netwr like vbak-netwr,
waerk like vbak-waerk,
end of it_t1.
select-options : so_vbeln for vbak-vbeln.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
it_sort TYPE slis_t_sortinfo_alv,
it_listheader TYPE slis_t_listheader,
it_alvevent TYPE slis_t_event.
DATA : wa_fieldcat TYPE slis_fieldcat_alv,
w_pos TYPE i VALUE 1,
wa_listheader TYPE slis_listheader,
wa_alvevent TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.
Data: it_outtab like it_t1 occurs 0 with header line.
DATA : MAILREC LIKE SOMLRECI1 occurs 0 WITH HEADER LINE,
MAILBIN LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILBIN2 LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILTXT LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILHEAD LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILSTRUC LIKE SOPCKLSTI1 occurs 0 WITH HEADER LINE,
MAILDATA LIKE SODOCCHGI1 occurs 0 WITH HEADER LINE.
DATA: BEGIN OF GT_OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF GT_OTF.
DATA: ITCPO LIKE ITCPO,
ITCPP LIKE ITCPP.
DATA: tlines type i,
len_in like SOOD-OBJLEN,
len_out like SOOD-OBJLEN.
data: gt_pdf like solisti1 occurs 0 with header line.
DATA: gt_otfdata LIKE SOLISTI1 occurs 0 WITH HEADER LINE.
CONSTANTS: c_formname_top_of_page TYPE slis_formname
VALUE 'F_TOP_OF_PAGE'.
select vbeln
erdat
ernam
netwr
waerk into corresponding fields of table
it_outtab from vbak where vbeln in so_vbeln.
loop at it_t1.
write:/ it_t1-vbeln,
it_t1-erdat,
it_t1-ernam,
it_t1-netwr,
it_t1-waerk.
endloop.
perform alv_disp.
*& Form alv_disp
text
--> p1 text
<-- p2 text
FORM alv_disp.
PERFORM build_fcat USING '1' 'VBELN' 'IT_OUTTAB' ' ' ' ' ' '
'SALESNO'.
PERFORM build_fcat USING '2' 'ERDAT' 'IT_OUTTAB' ' ' ' ' ' '
'CRTNDATE'.
PERFORM build_fcat USING '3' 'ERNAM' 'IT_OUTTAB' ' ' ' ' ' '
'CRNAME'.
PERFORM build_fcat USING '4' 'NETWR' 'IT_OUTTAB' ' ' ' ' ' '
'NETPRICE'.
PERFORM build_fcat USING '5' 'WAERK' 'IT_OUTTAB' ' ' ' ' ' '
'CURRENCY'.
***Top of Page Heading purpose " u can add the date and column over here
PERFORM buildtop USING it_listheader[].
perform top_of_page.
*------Sort The Catalog
PERFORM sort_cat TABLES it_outtab USING it_sort[].
*------Display Table In GRID
PERFORM disp_grid TABLES it_outtab[].
**For email stuff follow the perform
perform fill_struct.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = MAILSTRUC
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = MAILREC
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 SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_disp
*& Form build_fcat
text
-->P_0104 text
-->P_0105 text
-->P_0106 text
-->P_0107 text
-->P_0108 text
-->P_0109 text
-->P_0110 text
FORM build_fcat USING value(col_pos)
value(fieldname)
value(tabname)
value(key)
value(no_zero)
value(do_sum)
value(reptext_ddic).
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = col_pos.
wa_fieldcat-fieldname = fieldname.
wa_fieldcat-tabname = tabname.
wa_fieldcat-key = key.
wa_fieldcat-no_zero = no_zero.
wa_fieldcat-do_sum = do_sum.
wa_fieldcat-reptext_ddic = reptext_ddic.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. " build_fcat
*& Form Top_Of_Page
Top of page for Grid.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader
I_LOGO = 'MY_SAP_ENJOY'.
ENDFORM. "top_of_page
text
-->P_IT_LISTHEADER[] text
FORM buildtop USING IT_LISTHEADER type slis_t_listheader.
DATA : text(100) TYPE c.
CLEAR it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Sales Details' .
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Demo'.
APPEND wa_listheader TO it_listheader.
*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_listheader
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. " Top_Of_Page
*& Form sort_cat
text
-->P_IT_OUTTAB text
-->P_IT_SORT[] text
FORM sort_cat TABLES IT_OUTTAB STRUCTURE IT_OUTTAB USING IT_SORT
TYPE
slis_t_sortinfo_alv.
CLEAR wa_sort.
wa_sort-fieldname = 'VBELN'.
wa_sort-tabname = 'IT_OUTTAB'.
wa_sort-spos = 1.
wa_sort-up = 'X'.
wa_sort-subtot = ' '.
APPEND wa_sort TO it_sort.
ENDFORM. " sort_cat
*& Form disp_grid
text
-->P_IT_OUTTAB[] text
FORM disp_grid TABLES IT_OUTTAB STRUCTURE IT_OUTTAB.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZEX2' "sy-repid
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
IT_FIELDCAT = IT_FIELDCAT
IT_SORT = IT_SORT
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " disp_grid
*& Form fill_struct
text
--> p1 text
<-- p2 text
FORM fill_struct.
Text
MOVE 'Hi vijay ' TO MAILTXT-LINE.
APPEND MAILTXT.
Data
MAILDATA-OBJ_NAME = 'Document'.
MAILDATA-OBJ_DESCR = 'E-maiL From vij'.
MAILDATA-OBJ_PRIO = '1'.
MAILDATA-DOC_SIZE = strlen( MAILTXT ).
Structure
MAILSTRUC-HEAD_START = 1.
MAILSTRUC-HEAD_NUM = 0.
MAILSTRUC-BODY_START = 1.
MAILSTRUC-BODY_NUM = 1.
mailstruc-obj_name = 'Vijay Simha'.
MAILSTRUC-DOC_TYPE = 'RAW'.
APPEND MAILSTRUC.
Receivers
**u can use ur mail id(s) overhere
MOVE '[email protected]' TO MAILREC-RECEIVER.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.
***moving to the output/format of the attachment.
final pdf format in the mail attachemnt
LOOP AT it_outtab.
MOVE it_outtab-vbeln TO MAILBIN.
MOVE it_outtab-erdat TO MAILBIN+18.
MOVE it_outtab-ernam TO MAILBIN+40.
MOVE it_outtab-netwr TO MAILBIN+70.
MOVE it_outtab-waerk TO MAILBIN+78.
APPEND MAILBIN.
CLEAR MAILBIN.
ENDLOOP.
**convert the scrap to otf.
CALL FUNCTION 'SX_OBJECT_CONVERT_SCR_OTF'
EXPORTING
format_src = 'RAW'
format_dst = 'OTF'
devtype = 'POSTSCPT'
funcpara = ' '
len_in = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
tables
content_in = MAILBIN
content_out = MAILBIN2
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH MAILBIN.
CONVERT OTF to PDF
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'POSTSCPT'
FUNCPARA =
LEN_IN = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
TABLES
CONTENT_IN = MAILBIN2
CONTENT_OUT = MAILBIN
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH MAILBIN2.
DESCRIBE TABLE MAILBIN LINES TLINES.
Structure
MAILSTRUC-HEAD_START = 1.
MAILSTRUC-HEAD_NUM = 1.
MAILSTRUC-BODY_START = 1.
MAILSTRUC-BODY_NUM = TLINES.
MAILSTRUC-TRANSF_BIN = 'X'.
MAILSTRUC-DOC_TYPE = 'PDF'.
MAILSTRUC-DOC_TYPE = 'XLS'.
mailstruc-obj_name = 'Vijay.S.Reddy'.
MAILSTRUC-DOC_SIZE = tlines * 255.
APPEND MAILSTRUC.
ENDFORM. " fill_struct -
Send mail by attaching a pdf fetching data from tables.
Dear Team,
I have a requirement to send a mail by attaching a pdf.
Step1 : Getting the data fron tables based on some logic into internal tables. [DONE]
Step2 : Using this internal and making a pdf [At present I am making an excel sheet, But client requires non editable well formatted pdf]
Step3 : Attach this PDF and send it as a mail. [At present I am sending the attched excel but want to send pdf]
Sample code used is
** Body of the mail
WA_TEXT-LINE = 'Note : This is an autogenerated mail. Please do not reply to this mail.'.
APPEND WA_TEXT TO TEXT.
CLEAR WA_TEXT.
* create document from internal table with text
DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'RAW'
I_TEXT = TEXT
I_LENGTH = '12'
I_SUBJECT = I_SUBJECT1 ).
** Excel Attachemnt
*** Preparing the xcel
CONCATENATE 'SNO' 'Request' 'Data1' INTO WA_TEXT-LINE SEPARATED BY CON_TAB.
CONCATENATE CON_CRET WA_TEXT-LINE INTO WA_TEXT-LINE.
APPEND WA_TEXT TO TEXT.
CLEAR WA_TEXT.
CONCATENATE WA_SNO WA_REQUEST WA_DATA1 INTO WA_TEXT-LINE SEPARATED BY CON_TAB.
CONCATENATE CON_CRET WA_TEXT-LINE INTO WA_TEXT.
APPEND WA_TEXT TO TEXT.
CLEAR : WA_TEXT, TEMP_TYPE .
*** Attaching the excel
DATA : COUNTER TYPE I.
DESCRIBE TABLE TEXT LINES COUNTER.
LOOP AT TEXT INTO WA_TEXT.
SIZE = 255 + STRLEN( WA_TEXT-LINE ) + SIZE .
ENDLOOP.
CALL METHOD DOCUMENT->ADD_ATTACHMENT
EXPORTING
I_ATTACHMENT_TYPE = 'XLS'
I_ATTACHMENT_SUBJECT = I_SUBJECT
I_ATTACHMENT_SIZE = SIZE
I_ATT_CONTENT_TEXT = TEXT.
** Semding Mail
CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
IF REQUESTER_MAIL IS NOT INITIAL.
* create recipient for cc
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
I_ADDRESS_STRING = REQUESTER_MAIL ).
* add recipient with its respective attributes to send request
CALL METHOD SEND_REQUEST->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = RECIPIENT
I_COPY = 'X'
I_EXPRESS = 'X'.
ENDIF.
SEND_REQUEST->SET_SEND_IMMEDIATELY('X').
* ---------- send document ---------------------------------------
CALL METHOD SEND_REQUEST->SEND(
EXPORTING
I_WITH_ERROR_SCREEN = 'X'
RECEIVING
RESULT = SENT_TO_ALL ).
IF SENT_TO_ALL = 'X'.
WRITE TEXT-003.
ENDIF.
COMMIT WORK.
Please help me in this regard.
Thanks in advance.
SaiHi,
You can convert the data into spool and then pdf,
please go through this link in this data from an internal
table of an script or an smartform is converted into spool
and then sended into mail,
https://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
Hope it helps
Regards
Mansi -
How to upload a PDF-file and send it by SAP Mail
Hi,
we need to attach a pdf-file to an email send by SAP. The file is stored in a SAP-directory. When I use Open dataset to get the file it works but when sent by email the file could not be opened. I guess that perhaps I have to use other parameters to get the PDF in a correct file but I don't know which ones. Here is part of the coding I use for testing:
TYPES: BEGIN OF typ_pdf,
line(255),
END OF typ_pdf.
DATA: it_pdf TYPE STANDARD TABLE OF typ_pdf,
wa_pdf LIKE LINE OF it_pdf.
v_file = '/pool//Test.pdf'.
OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
WHILE ( sy-subrc EQ 0 ).
READ DATASET v_file INTO wa_pdf.
IF NOT wa_pdf IS INITIAL.
APPEND wa_pdf TO it_pdf.
ENDIF.
CLEAR wa_pdf.
ENDWHILE.
CLOSE DATASET v_file.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_bin = it_pdf
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.
Regards
NicolaHi Nicola,
read the pdf from dataset as binary into an XSTRING.
use function to convert xstring to table.
Do not use SO_DOC.. function but CL_BCS (see blog 'unknown thus unloved'
Regards,.
Clemens -
How to run 2 reports to send 1 PDF e-mail attachment instead of 2 e-mails.
I used 9i Reports to create 2 reports in a PDF format. I run these reports from a 9i form using the web.show_document command. XML is used to send the 2 e-mails with the reports.
Is there a way I can combine the running of the reports to make one PDF to created 1 e-mail attachment or run the reports at the same time and attach 2 PDF files to 1 e-mail.
I have no problems running 1 report and sending 1 e-mail attacment!
This is example of the XML used in creating the e-mail:
- <destinations>
- <foreach>
- <file id="Test" name="REPORT_1.pdf" format="pdf" instance="XXXX">
<include src="report" />
</file>
</foreach>
- <!-- Send a mail with an attachment
-->
- <mail id="ex1" to="&DESNAME" from="&DESNAME" subject="&DESNAME;*;&p_postal_number: was submitted for
approval on &p_postal_date">
<body srcType="text">This is to notify you of a new submission that requires an approval before being
sent to out. Please use the URL link below to review the information as soon as possible.
https://xxxx.aaaa.sss.com:234/web_html/static.html AAAA Administrator</body>
- <attach format="pdf" name="Report_1&.pdf" srcType="report">
<include src="mainSection" />
</attach>
</mail>
</destinations>You can use iText to combine two PDF files into one.
-
How to automatically attached multiple PDF reports to an e-mail and send
Hello.
I have a requirement to generate multiple PDF reports using Oracle Reports 6i on the web, then automatically attach these PDF reports to an Outlook e-mail and then bring up the Outlook e-mail dialog box so the user can modify the e-mail (such as adding more attachments, adding a CC, BC, change the message text) before sending the e-mail. I want to be able to initiate all these tasks from Oracle webforms 6i in a three-tier environment.
I have already read various notes and solutions but none of them address all my requirements. Examples:
1. Using OLE to interface with Outlook - but OLE does now work on the Web
2. Using Java stored procedure or UTL_SMTP - but this does not bring-up an e-mail dialog box
3. Using mailto: in HTML and web.show_document - but this does not allow you to attach a PDF file
Can you please advise on possible solutions to my requirements. Thank you very much.
Regards,
ArmandoHere is a great resource for sending binaries.
http://otn.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
You'll want to use utl_http to run each report with a destype=file and then have another procedure running to check to see when all of your reports have finished. After they are finished, you would run the stored procedure to get all of the binaries, attach them in an email and then send it.
If you want to concate all of the PDF files into one large file, you can do this with a Java stored procedure using iText.
http://www.lowagie.com/iText/ -
Hi Folks,
When I attach a jpg or pdf to a mail it shows as the whole document "pasted" into the mail. Anyone know how I get the file to just show as an icon and not as a mass of pasted in docs?
Thanks,
PedroFor your own viewing, you can of course control-click on the attachment and select "View as Icon".
For others' viewing, it depends upon their email reader. To ensure that attachments are not displayed expicitly you can put them all in a zip file (via control click and "Compress") then attaching them, or you can use third party stuff like Attachment Tamer.
charlie -
When sending a single page PDF file in mail, it always appears as an open file in the message body. Multiple page PDF files appear as attachments. Why the difference and how to change the behavior of single page PDF files so that they appear as attachments instead of open files?
Hello billsbs,
Welcome to the Apple Support Communities!
I understand that when you add a PDF to mail you see its entire contents, but when you add two or more pages Mail shows them as a document icon. To change this behavior for that specific email, please follow the instructions in the attached article.
Mac OS X Mail: About PDF attachments
Have a great day,
Joe
Maybe you are looking for
-
How to make open a pagein another window
When I click on the image, another page is opening, but in (at the place) my first window. Here the script : on(press){ getURL(" http://www.mysite.com/anotherpage.htm/","_self") How can I make it open in another window?
-
Clearing in foreign currnency and local currency and F13E
Hello, I have a GL account whose Balance in Local Currency Only (BILCO) and Open Item Management (OI) flags are set. The line items posted to this account are always in foreign currency say EUR. In the month end, we use F13E (Automatic clearing with
-
Returning database query results under Apache Axis
I'm trying to write a web service that will return the results of a standard database query. Does anyone have any pointers on what sort of data structure I should convert my ResultSet to that would be best suited to run under Apache Axis? Currently I
-
I have been reading through this forum and there seems to be no shortage of upset customers. They all seems to be asking the same questions over and over again, and the only answer given is, "I'll post more information when I get it". Now, I'm not a
-
Hi, I am using LabVIEW 8.2.1 (RT & DSC) I need to process something while having all the prime numbers less than 1E9 available. there are approximately 51 million. is it ok with LabVIEW? (array of the size 51 million) I will use 64bit array. can Lab