Sending PDF + Excel as Email attachments in Unicode System
Hi,
I have a problem in sending mails having 2 attachments. one with PDF and another Excel. I use SO_DOCUMENT_SEND_API1 by populating contents_bin table. PDF attachment is fine (PDF is created from spool), but excel attachment fails to open correctly. I refered note 1151258, but not successfull.
When I tried using contents_hex as suggested in report SENDLIST, the PDF attachment is corrupted.
The above method works fine in non-unicode system. But not in a unicode system.
In short I want to send two attachments (one PDF by reading spool and second excel by using an interanl table) in a mail. Any ideas & suggestions please?
Thanks,
Ravikanth
HI,
use below logic..
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
*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 '' '' '' 'PASSPORT AND VISA DETAILS REPORT' ' '
INTO lt_attach SEPARATED BY SPACE.
CONCATENATE con_cret lt_attach INTO lt_attach.
APPEND lt_attach.
CONCATENATE 'Per.Num' 'Sub.Type' 'First.Name' 'Dep.Name'
'Nation ' 'Pass. Num' 'Exp.Date' 'Visa.Num' 'Exp.Date'
INTO lt_attach SEPARATED BY con_tab.
CONCATENATE con_cret lt_attach INTO lt_attach.
APPEND lt_attach.
LOOP AT ot_dependent INTO wa_dependent.
CONCATENATE wa_dependent-pernr
wa_dependent-subty
wa_dependent-subtype_text
wa_dependent-vorna
wa_dependent-favor
wa_dependent-fanat
wa_dependent-zzicnum
wa_dependent-zzexpid
wa_dependent-zzvcnum
wa_dependent-zzvexpid
INTO lt_attach SEPARATED BY con_tab.
CONCATENATE con_cret lt_attach INTO lt_attach.
APPEND lt_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
FORM f_send_email_passport_details .
Populate message body text
PERFORM populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES lt_message
lt_attach
USING p_email
'Passport and Visa .xls document attachment'
'XLS'
'filename'
CHANGING gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
ENDFORM. " F_SEND_EMAIL_PASSPORT_DETAILS
FORM f_send_email_passport_details .
Populate message body text
PERFORM populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES lt_message
lt_attach
USING p_email
'Passport and Visa .xls document attachment'
'XLS'
'filename'
CHANGING gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
ENDFORM. " F_SEND_EMAIL_PASSPORT_DETAILS
*& 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 lt_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( lt_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 lt_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 = lt_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
Regards,
Naresh Chava.
Similar Messages
-
How do you send pdf attachment using email address listed on pdf
I pdf'd mail merge document and now want to send these out. I click on the email address at the top of the document and it creates a new email but it does not attach the pdf. How do I do this?
How to Attach Photos and Videos to Emails on an iPhone or iPad
http://www.wikihow.com/Attach-Photos-and-Videos-to-Emails-on-an-iPhone-or-iPad
iPad Basics: Sending an Email With An Attachment
http://ipadacademy.com/2012/03/ipad-basics-sending-an-email-with-an-attachment
How to add, send and open iPad email attachments
http://www.iskysoft.com/apple-ipad/ipad-email-attachments.html
How to Send Multiple email Attachments from your iPad or iPhone
http://ipadacademy.com/2014/03/how-to-send-multiple-email-attachments-from-your- ipad-or-iphone
Cheers, Tom -
Pdf files as email attachments come in unreadable Word
pdf files as email attachments come up in unreadable Word. What am I doing wrong?
These files are saved as .pdfIf they automatically open in Word, then you need to change the file association.
Easiest by uninstalling/reinstalling Adobe Reader. -
Trouble send PDF file by email
Hi I down loaded the new ios7 app and since then I have had trouble sending PDF files via email can any 1put any light in it?
Just like any other file...
On Sat, Mar 7, 2015 at 12:16 AM, larrys19338374 <[email protected]> -
Sending PDF attachment through EMAIL Triggering
Hi,
Could you plaese let me know How to send Pdf Attachments
through Email in SAP.
Using Function Module SO_NEW_DOCUMENT_ATT_SEND_API1.
Regards
BhuvanaHi,
GP does not involve any sort of coding.
Just like workflow, GP has a flow desgined in a process.
Each step has a callable object associated with it.
Check [this|http://help.sap.com/saphelp_nw04s/helpdata/en/0f/619fd378a641b29386063019c24fc4/frameset.htm] link for details
-Ashutosh -
Error while sending PDF file by Email
Hi All,
I have a requirement to send multiple files by Email attachement from SAP to internet address.
All files sent correctly, except one PDF file.
I have 2 spools, and I am using FM CONVERT_OTFSPOOLJOB_2_PDF to get PDF data for Spool.
Then I am converting the 134 length PDF data to 255 Email Attachement binary table.
Now I have 2 file F1.PDF and F2.PDF, in SAP Office outbox and in receivers email, F2.PDF opening fine, however for F1.PDF I am getting some error no 109 in Adobe, which says "There was an error processing a page.There was a problem reading this document. (109)".
Please help in figuring out the reason for this.
Additional Information F2.PDF has some text data (SAP Script output) and F1.PDF has some text data with logo (SAP Script Output)
Thanks in advancehi check out following code..
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. -
How to send PDF attachment through Email For Purchase Order
Hi,
Can you please tell me how to send the Purchase Order with PDF attachment. Thank you.
Thanks & Regards,
Rani.Find the below example
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_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.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
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[] = it_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.
Reward if helpful.
Thanks,
Kishore S N -
Send PDF form to email address user enters in textfield on form.
I would like to be able to allow the person using the form to choose what email address the PDF form is emailed to. I read this post which sounds like what I want but I keep getting a Submit Cancelled error. The email does get generated and the form is attached as a PDF so that part works okay.
http://forums.adobe.com/message/4167414#4167414
This is the code I am using as I only need the To: address populated.
form1.Page1.Button1::preSubmit:form - (JavaScript, client)
var strToAddress
//Capture the values from the form fields.
strToAddress = txtToAddress.rawValue;
event.target.submitForm({cURL:"mailto:"+ strToAddress,cSubmitAs:"PDF",cCharset:"utf-8"});Hi,
There is an example here: http://assure.ly/eUR4wJ.
// Declare the variable
var vEmail;
// Check that the email field is not null
if (txtToAddress.rawValue !== null) {
vEmail = txtToAddress.rawValue;
// Send email
event.target.submitForm({cURL:"mailto: " + vEmail + "?subject=&body=",cSubmitAs:"PDF",cCharset:"utf-8"});
Niall -
TS3276 Can't send PDF files by email
I can't send PDF files of photo from my email. ??
Dropbox
A simple and popular way to copy files and share files amoung your devices.
https://www.dropbox.com/
copy to Share folder & email them that they have access
copy to Public folder & email them the link.
Robert -
Send PDF, EXCEL, MS Word from SAP to third party
Hi All,
My requirement is we have to upload docs from PC and send to third party system.
Now my doubt is how can we upload the docs like PDF , Excel, MS Word etc from PC to sap and send it to third party.
Thanks & Regards
Satyamkumar JhaHi Prabhudas,
Thanks for your inputs.
I have one more doubt.
If you open any delivery in VL03N transaction just below the Menu bar there is button called 'Services for Object'. using this we can attach any document to this Delivery.
Is there any way to attach this newly uploaded document using some Z program (referring tcode CG3Z ) to this delivery.
Regards
Satyam -
Hi '
I have a acrobat pro 9 and when i tray to send the file to email i get that i dont have an email defualt set .
I have set the outlook as the defualt program and still get the same message .
what can i do ?The problem may be related to the OS you have, the mail client being used, or whether mapi is properly activated on a Windows machine.
-
PDF conversion for chineese characters in Unicode system
I am facing a problem while converting the SAP Script Output to PDF format for Chinese characters.
I am working on ECC (5.0) Unicode system.
Scenario:
After saving a Purchase Order an E-mail is sent to the customer - attaching the
PO output in PDF format. E-mail was received successfully by the receiver, but while opening the pdf all the chinese characters were displayed in junk characters in the pdf. All the English characters are properly displayed. I tried to open the pdf file in Acrobat Reader versions 6.0, 7.0, 8.0. but no result. I used CONVERT_OTF function module for converting the OTF format to PDF format. I tried using the fonts CNSONG also.
I tried by executing the standard program RSTXPDFT4 for converting to PDF by giving the spool. In the spool it is showing the Chinese characters perfectly but in the PDF the Chinese characters were were showing as Junk.
Can you please help and advice to see the Chinese characters in PDF in Unicode systems.
Thanks in advance.>
Juraj Danko wrote:
> Hi,
> I have similar problem than you ... how have you solved it?
> thanks
> Juraj
I found a solution, but I am not sure, if it was for this problem or
output problem with for example PL in non-unicode systems.
I created the input for CONVERT_OTF with CALL FUNCTION 'PRINT_TEXT'.
PRINT_TEXT has to be called with DEVICE = 'PRINTER',
DEVICE = 'ABAP' uses internally the wrong code page.
You have also to set otf_options-tdprinter to a valid printer,
if it is empty, the default printer from user settings is used.
You can use code example from SAP note 413295.
Before you call CONVERT_OTF, you can also check entries with 'FC' in OTF input.
The font (see description of OTF format in SAP help) must be set like described in SAP note 144718.
/Tibor
Edited by: Tibor Gerke on Jan 13, 2011 10:29 AM -
Sending IDOCs from an MDMP to a Unicode system
Colleagues
I have been trying to send IDOCs containing Chinese characters from an MDMP system to a Unicode system. The data is not being translated from the Chinese code page 8400 to Unicode format.
To date I have created a new IDOC segment, within the original IDOC, which contains the language dependant data preceded by a language element. I have also maintained SM59 on the receiving system (Unicode) to mark the sending system (in SM59 defined as an R/3 connection) as non-unicode, and activated the MDMP settings and mapping the language key ZH to codepage 8400. I have also checked that the language key and code page is valid in the unicode box.This still doesnt work.
I was under the impression that the RFC system would translate the IDOC line by line and if it found a language key in the segment translate it using the code page assigned to that language, but this doesnt seem to be the case. The sending system is 4.5C and the receiving system 4.7.
Is there anyway to get this to work without playing with the IDOC processing routines such as IDOC_INBOUND_ASYNCHRONOUS? Is there something Im missing?
Thanks in advance for your help.Hi,
Perhaps you may want to try to use IDoc file interface instead of RFC.
You can use standard program RSEINB00 to process and post the IDoc file.
Regards,
Ferry Lianto -
Sending PDF File as Email not working
Hi,
We are not able to send email as pdf file using submit by email button but xml type is workingThe submit by email is hardcoded to send an xml file (Note that by default Reader can only send the xml file). If you want to send the PDF then you will have to drop a button object from the standard palette, set the Control Type to Submit, and on the Submit tab use the mailto protocol as the Submit To URL parameter. Just below that there is a Submit dropdown where you can pick PDF as your submission. Now if your users are using Reader you will have to Reader Extend the file before they can use your button.
Hope that helps
Paul -
Send PDF-Spool via email-Attachment
Hi,
i send an internal table to spool and convert it.
this works ok.
But when i send it via
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
i have problem with the attachment (PDF-Error).
Has anyboby a codeexample?
Here my short report until Conversion into PDF
REPORT ZGRO_TEST.
TABLES: MARA.
DATA: BEGIN OF ITAB OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF ITAB.
DATA: FILESIZE TYPE I.
Spoolnummer
DATA: SPOOL_NR LIKE TSP01-RQIDENT.
PDF Ausgabetabelle
DATA: BEGIN OF PDF_OUTPUT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF PDF_OUTPUT.
START-OF-SELECTION.
SELECT * FROM MARA INTO TABLE ITAB UP TO 100 ROWS.
Ausgabe in Spool umleiten
NEW-PAGE PRINT ON LINE-SIZE 255
NO DIALOG
NO-TITLE
NO-HEADING
IMMEDIATELY ' '.
interne tabelle ausgeben
LOOP AT ITAB.
WRITE:/ ITAB.
ENDLOOP.
Rücksetzen Spollausgabe auf Bildschirm.
NEW-PAGE PRINT OFF.
Spoolnummer besorgen
SPOOL_NR = SY-SPONO.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = SPOOL_NR
IMPORTING
PDF_BYTECOUNT = FILESIZE
TABLES
PDF = PDF_OUTPUT.
END-OF-SELECTION.
How can i use the PDF_OUTPUT as email attachment?
Thanks for help.
Regards, Dieterafter you get the pdf output:
do like this:
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as pdf PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .pdf documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
FORM send_file_as_email_attachment tables it_message
it_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.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
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[] = it_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.
Regards,
Ravi
Maybe you are looking for
-
How Can I Reinstall Printer Capability in 10.4.3 ?
Recently I tried to access the printer utility for my Epson C60 (trying to see remaning ink level). No windows appeared, yet the program was listed in the Dock. I couldn't quit the program so I force-quit it. The system indicated that the program had
-
Sync with Outlook ONLY for a specific date range
I have a Zire 31 that I'm syncing with Outlook via latest Palm Desktop/HotSync. I did just install the latest conduit. I was getting several repeating calendar entries that were not syncing with the Zire (annual birthdays, etc.) - turns out that th
-
I have a ibook G3 and wanted to install ilife '06. I have the newest version of OS X but said it couldn't install ilife because I don't have a G4 proccessor. Is this an update I can buy? or would i have to buy a whole new computer? Please someone hel
-
Wifi connection with 4s not working after installing new software ios6
wifi connection with 4s not working after installing ios 6.
-
I have a Datagrid that is populated dynamically. For each item there are 5 columns all having the same width. I set the grid to be wide enough to display one set of 5 columns, one of the columns uses a numeric stepper as an itemRenderer/Editor. The p