Invoice output as PDF attachment via email.
Hi All,
I have a requirement wherein an invoice when saved should generate a mail output (external send) with the invoice as a PDF attachment. I have the system set up for external send & scot settings but am stuck up with the PDF attachment. I also have the same requirement for PO output (because I look into both SD and MM). Any help on either of them would be greatly appreciated.
Thanks & Regards,
Vidya Sagar
Hi,
[External Send - Sending PO by email|http://www.sap-img.com/materials/external-send-sending-po-by-email.htm]:
In order to send PO, your Basis team must configure the system first so that external email can be send out from SAP. If it is not configured, no settings you do on MM will work.
1. You must maintain email address in vendor master data.
2. The same applies to your user master data. For the output type for default values, a communication strategy needs
to be maintained in the Customizing that supports the e-mail. You can find the definition of the communication strategy in the
Customizing via the following path:
(SPRO -> IMG -> SAP Web Application Server -> Basic Services -> Message Control -> Define Communication Strategy).
As a default, communication strategy CS01 is delivered. This already contains the necessary entry for the external communication. Bear in mind that without a suitable communication strategy it is not possible to communicate with a partner via Medium 5 (external sending).
3. Use the standard SAP environment (program 'SAPFM06P', FORM routine 'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.
4. In the condition records for the output type (for example, Transaction MN04), use medium '5' (External send).
5. You can use Transaction SCOT to trigger the output manually. The prerequisite for a correct sending is that the node is set correctly. This is not described here, but it must have already been carried out.
6. To be able to display, for example, the e-mail in Outlook, enter PDF as the format in the node.
Regards,
Srilatha.
Similar Messages
-
To send output as a PDF attachment via email
Hi experts
I have the (smartform) output data in OTF format..and displaying it in PDF form with FM 'HR_EFI_SHOW_PDF_FORM' .
Now the requirement is <b>to send this output as a PDF attachment via email</b>.
Please help me with sample code to perform this.
Regards,
Matt.Hi,
Check this links,
/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
Also for email:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8cd6adbb-0301-0010-39ba-938c601d5db9
Refer the following link for more details:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
Thanks,
Reward If Helpful. -
Error opening PDF attachment (via email)
Hello,
I've problems to send a PDF file with the function:
'SO_DOCUMENT_SEND_API1'
At first a small overview of my process:
- 'SCMS_DOC_READ' -> to read the file from the archive
- 'SCMS_BINARY_TO_FTEXT' -> to convert from bin. to pdf
- 'SO_DOCUMENT_SEND_API1' -> to send the email
My pdf result:
% P D F - 1 . 4 % â ã Ï Ó 1 0 o b j < < / T y p e
Project scope:
%PDF-1.4%âãÏÓ1 0 obj<</Type
As a result, by opening the PDF file an error occured.
Further information:
objpack-transf_bin = 'X'.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = doc_data
put_in_outbox = ''
commit_work = 'X'
tables
packing_list = objpack
object_header = objhead
contents_bin = data <- PDF content
contents_txt = objtxt
receivers = reclist
exceptionsmost possible reason has been discussed in:
Error in opening PDF attachment -
Error opening PDF file when send as attachment via email
Hi,
I searched around the forum to resolve my issue and there's alot of post that is related but i can't find any answer to my issues.
Here's the scenario :-
I try to convert the smartform to PDF and then send the PDF as an attachment via email.
After converting the smartform to PDF, i managed to download the file and view it without any problem but i can't view the PDF as an attachment. It has the following error :-
Adobe Reader could not open '4500002325.PDF' because it is either not a supported fle type or because the file has been damaged (for example, it was sent as an email and wasn't correctly decoded
The following is the snapshot of my code:-
* Determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
* error handling
ent_retco = sy-subrc.
PERFORM protocol_update_i.
ENDIF.
ls_control_param-getotf = 'X'.
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
zxekko = l_doc-xekko " user_settings = ' '
zxpekko = l_doc-xpekko
IMPORTING
document_output_info = l_ssfcrespd
job_output_info = l_ssfcrescl
job_output_options = l_ssfcresop
TABLES
l_xekpo = l_doc-xekpo[]
l_xekpa = l_doc-xekpa[]
l_xpekpo = l_doc-xpekpo[]
l_xeket = l_doc-xeket[]
l_xtkomv = l_doc-xtkomv[]
l_xekkn = l_doc-xekkn[]
l_xekek = l_doc-xekek[]
l_xkomk = l_xkomk
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = v_len_in
BIN_FILE = v_bin_file
TABLES
OTF = l_ssfcrescl-otfdata
LINES = l_pdf
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
* email subject
CONCATENATE 'Purchase order' l_doc-xekko-ebeln INTO lw_subject
SEPARATED BY space.
* RECIPIENTS
lwa_recipients-rec_type = 'U'.
lwa_recipients-express = 'X'.
SELECT adr6~smtp_addr
INTO TABLE gv_smtp_addr
FROM ekko AS ekko INNER JOIN
lfa1 AS lfa1 ON ekko~lifnr = lfa1~lifnr INNER JOIN
adr6 AS adr6 ON adr6~addrnumber = lfa1~adrnr
WHERE ekko~ebeln = l_doc-xekko-ebeln.
IF NOT gv_smtp_addr[] IS INITIAL.
LOOP AT gv_smtp_addr INTO gv_smtp_addr_line FROM 2.
lwa_recipients-receiver = gv_smtp_addr_line.
lwa_recipients-copy = ''.
APPEND lwa_recipients TO ptb_recipients.
ENDLOOP.
* Text Data
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = 'E'
name = 'TEST'
object = 'TEXT'
TABLES
lines = lv_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT lv_lines INTO lv_lines_line.
ltb_objtxt = lv_lines_line-tdline.
APPEND ltb_objtxt.
ENDLOOP.
DESCRIBE TABLE ltb_objtxt LINES lw_tab_lines.
READ TABLE ltb_objtxt INDEX lw_tab_lines.
* document data contains information for the whole message
lwa_doc_chng-obj_descr = 'ABAPlist'.
* Control Data
lwa_doc_chng-obj_name = 'TESTING'.
lwa_doc_chng-sensitivty = 'F'.
lwa_doc_chng-no_change = 'X'.
lwa_doc_chng-priority = '1'.
lwa_doc_chng-obj_prio = '1'.
lwa_doc_chng-obj_langu = sy-langu.
CLEAR ltb_objpack-transf_bin.
*Attachment
*Move the binary attachment to other internal table.
ltb_objpack-head_start = 1.
ltb_objpack-head_num = 0.
ltb_objpack-body_start = 1.
ltb_objpack-body_num = lw_tab_lines.
ltb_objpack-doc_type = 'RAW'.
APPEND ltb_objpack.
clear : lw_tab_lines.
*Get the number of lines in the Attachment (PDF FILE)
* DESCRIBE TABLE it_mess_att LINES lw_tab_lines.
DESCRIBE TABLE l_objbin lines lw_tab_lines.
ltb_objpack-transf_bin = 'X'.
ltb_objpack-head_start = 1.
ltb_objpack-head_num = 1.
ltb_objpack-body_start = 1.
ltb_objpack-body_num = lw_tab_lines.
ltb_objpack-doc_type = 'PDF'.
ltb_objpack-obj_descr = l_doc-xekko-ebeln.
ltb_objpack-doc_size = lw_tab_lines * 255.
APPEND ltb_objpack.
*Email Subject
lwa_doc_chng-obj_descr = lw_subject.
lwa_recipients-receiver = recipeint.
lwa_recipients-rec_type = 'U'.
lwa_recipients-copy = 'X'.
lwa_recipients-express = 'X'.
APPEND lwa_recipients TO ptb_recipients.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
COMMIT_WORK = 'X'
TABLES
packing_list = ltb_objpack
contents_bin = l_objbin
contents_txt = ltb_objtxt
receivers = ptb_recipients.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDIF.
Edited by: ~loObie on Apr 23, 2010 12:01 PM
Edited by: ~loObie on Apr 23, 2010 12:02 PMDid you send the pdf in the following format ...
2. Sending PDF as mail.
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = sy-uname.
t_receivers-rec_type = 'B'.
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.
Quote from the Following [LINK|http://www.sap-basis-abap.com/smartforms/convert-the-smart-form-into-pdf-and-send.htm] -
Send spool list ceated by Job (SM36) as pdf-file via email
We are running the report RM06EFLB (Transaktion ME84 - "Create Releases") in the background.
The Job is creating a spool list with 17 pages.
I want to send this 17 pages (in a readable form) to a number of persons.
This did I try so far:
- Distribution list with Recipient type "via Internet" as Spool list recipients in the Job. (Tried different formats for ABAP List in Transaction SCOT)
=> Email is send to recipients, attachment is readable depending on format.
Problem: attachment is not complete, it contains only about 15 pages (985 rows).
- Distribution list with Recipient type "Internal User - SAP-Office" as Spool list recipients in the Job.
=> Document is sent to Business Workplace
Problem: attachment is not complete, it contains only about 15 pages
Any ideas how to get the complete spool list?
Is there mayby a report around that is sending a spool list as pdf-file via email to a number of recipients?
(Would like to maintain this Report as an additional step in the job. The spool-number should be selected from the previous step.)
Thank you for your help.
JensOh sorry - here is the coding which is used in that program:
First use function module 'CONVERT_ABAPSPOOLJOB_2_PDF' to convert the spool entry into pdf.
Loop at output table PDF and concatenate all lines into a string. Convert string to xstring.
Then call mail class:
DATA: lv_pdf_x TYPE xstring,
lv_subject TYPE string,
lv_doc_desc TYPE so_obj_des,
lv_mail_body TYPE soli_tab.
DATA: ls_atta TYPE rcf_s_att4mail_hex,
lt_atta TYPE rcf_t_att4mail_hex.
* -- Fill parameter
lv_subject = 'Requested Report'."#EC NOTEXT
lv_doc_desc = 'Report XXL'."#EC NOTEXT
* lv_mail_body = ?
ls_atta-name = lv_doc_desc.
ls_atta-extension = 'PDF'.
ls_atta-content = p_pdf_x. <- This is your xstring
APPEND ls_atta TO lt_atta.
TRY.
CALL METHOD cl_hrrcf_services_mail=>send_web_mail
EXPORTING
p_subject = lv_subject
p_receiver = p_receiver->email_address
pt_atta_hex = lt_atta
p_sender = p_sender->email_address
p_body_c = lv_mail_body.
CATCH cx_hrrcf.
ENDTRY.
I hope that you have the above mentioned class in your system but it should work with other email functions as well.
Regards
Nicola -
How to send an ouput as PDF attachment to email
Hi,
We have a 'Z' output for a delivery document. The output has the standard RLE_DELNOTE driver program and a Zsmart form assigned to it. We need to send the output as an attachment to email. Can some one please adivice how this can be achieved?
Thanks in advance
KatHi,
Plz try following steps.
1. Note the spool request No.
2. In T/code SE38, Enter The programme and execute.
3. In sub Object- Click Documentation and then do debuggung.
4.Enter spool request no and desired location and execute.
5. In ABAP Debugger- Use F8 key.
6. Select the desired location and file name and save.
View the desired output in PDF and can be sent through mail.
Hope this helps.
Regards,
Jaiprakash.P.T -
Portrait Layout of the pdf attachment in email (T-code: VL71)
Hi all,
I have a problem with the layout of the pdf attachment in email. The sapscript layout is already set to Portrait.
When I print or preview the form, it is in portrait. but when I sent it through email, the form became LANDSCAPE layout in pdf file. I dont know what i happening. I had tried to check everything possible but just useless. Please give me some light.
t-code = VL71
output type = LQFF (Certificate of Analysis)
I had checked T-Code: NACE, the method = 5 External Send. but there is no way to see whether the attachment is send as Portrait Layout or Landscape Layout.
I want it to be in PORTRAIT when send as attachment through External Send. How to set/configure the pdf layout when sending it through email?
Any idea & help are greatly appreciated.
THanks.Hi,
It has something to do with the printer or email setting, I personally think it is not ABAPer's role to set it.
SAP Standard Print program is used. RQCAAP00
Please help. thanks -
Sending smartform output as PDF attachment, Error opening PDF attachment
Hi Experts,
I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSmartformtoPDFformat&
The information should be on my smartform are some text, company logo and a barcode.
With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
An unrecognized token 'Td0' was found
There was problem reading this document(16).
There was problem reading this document(111).
Does anyone have idea of these ? Your help is greatly appreciated.
Thank you,
Suryaplease see this code ... for sending the Email as PDF attach file,
*& 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 points if it is usefull ....
Girish -
Sending PDF attachement via OUTLOOK
Hello All,
I am sending the output of a sales order as a PDF attachment via outlook mail.
It wokrs fine. but only worry is the Chinese characters are appearing strange and not the characters what we need. The function module used to convert OTF to PDF is CONVERT_OTF.
If I print / preview the output in SAP it shows the Chinese characters correctly.
What can be the reason ? Please help.
Thanks.pdf download software correctly multi language supports
-
How do you send an attachment via email created on a mac
how do you send an attachment via email to another recipient who does not have a mac?
As long as you send it in a recognizable format such as a .jpeg (or .jpg) used for most photos/images or .pdf used for a lot of word processing docs, there is no problem. Also, while in the Mail window, choose "send Windows compatible". It's not who or what you create it on, it is the format you send it in.
-
Sending a binary attachment via email, looking for a more clean way
Hi experts.
I finally managed to send a binary attachment via email. Why "finally"? Never done before!
Also I got to manage the "not standard" .SAP file extension, because the attachment is a transaction link.
So let me explain how i did it:
take SO_NEW_DOCUMENT_ATT_SEND_API1, filling following input data:
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = st_docdata
commit_work = 'X'
TABLES
packing_list = lt_packlist
contents_hex = lt_hex
contents_txt = lt_content
receivers = lt_recv
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.
But how to fill lt_hex? Well I did not found a way to transfer text data into raw data structure (lt_hex is type SOLIX).
So, here is the trick:
fill another table, lt_bin type SOLISTI1, with attachment content (text data);
dump lt_bin content to a file on application server, having care to specify TEXT MODE and UTF-8 encoding;
now reopen the same file in BINARY MODE and transfer content to lt_hex.
Why I did not use parameter
content_bin
? Because SAP ECC 6 is unicode enabled (I think UTF-16) and file has got to be UTF-8 or ASCII. Also, packing_list for attachment must specify binary tranfer mode. And doing so each UTF-16 character (2 bytes) is split into 2 characters (1 char + 1 NUL byte). Attachment is now unusable.
What is the question? Here it is: how to fill lt_hex data directly from text (UTF-16) data, avoiding conversion errors?
Thank you in advance.Hi Chhayank,
the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
~Florian -
Huge Issues with PDF Attachements in Emails
I am using my Q10 as my business device and most of the time I love it, it brought me back to BBRY. But one thing is really causing me headaches and problems I thought were left in the past since a couple of years.
I receive and send a lot of Emails and I rely a lot on this way of communication. But with the Q10, I always have to carry my old iPhone 5 with me, because the Q10 can´t open roughly 50% of all the PDF attachments on Emails. I just found a PDF Viewer which can open those files, but its a hustle which I don´t understand, because its actually the first phone which I owned in the past years which has such an issue in such an essential feature.
For example, one of my employee´s just send me a handwritten checklist as a PDF document via Email and when I try to open the file, the viewer, which is started out of the Email-Programm, says (in german) that an error occured while opening the file. The Acrobat Reader gives the same error-message. qPDF Viewer is able to open the file without an issue at all. Also the iPhone 5, iPad and every Email programm that I tried has no problem to open the file.
My employee used the built-in scan-to-PDF-functionality of one of our HP Officejet 8600 Pro printers in the office to create the file. It was not changed after the scan-process.
I bet that the issue is known, but if I can help, I will provide as much information as you need (incl. sample-files of course), but this problem needs to be fixed immediately. I can´t think of a serious business device which has problems showing several PDF-files, this is something every Smartphone can do since the 8800 or even before that, and without any problems! Not to mention all the toyish Android Smartphones and iPhones on the market. This is a key feature for many many many companies, just imangine you´re in a hurry and you need to decide upon a changed offer, but you´re not able to open the file on your phone? You´ll need to carry an extra device for that, thats not good.Hey -jo-,
Welcome to the BlackBerry® Support Community Forums.
Currently the BlackBerry Q10 smartphone supports PDF files with true PDF text, rather than scanning images into the PDF. Alternatively, if the sender has the option they can try sending the file as a text file(.txt).
Let me know if you have any other questions.
Thanks.
-HB
Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)! -
Sending smartform as PDF attachment through email
Hi,
I have used the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the smartform as PDF attachment through email.In SOST transaction I can see that the mail has been sent to the reciepient,but the mail is not going to the mail box.What would be the reason for this?
Regards,
HemaThat should be the basis issue. They needs to do some settings. Please ask them to do so.
Pranav -
Simple report list output sent as attachment thru email
Hi All,
Here's my task : I need to schedule a bi-weekly report that obviously runs in the background and produces output. From that output, I want to capture (with no manual intervention) the list output to an attachment and email a recipient. I've looked over code snippets and understand most of the <b>LIST</b> functions, but most deal with uploading a file from the frontend, which I do not want. Any ideas? Thx in advance.
JimHi
see the sample report to send mail as attachement
modify it as per your requirement
Mailing with Attachment by ABAP Coding
Refer this link:
Mail with attachment.
FORM send_list_to_basis .
DATA: w_path LIKE rlgrap OCCURS 0 WITH HEADER LINE,
lt_index TYPE sy-tabix,
doc_type(3) TYPE c,
descr LIKE it_objpack_basis-obj_descr,
temp_data LIKE w_path,
temp1 TYPE string,
tab_lines TYPE i,
langu(15) TYPE c,
expirydate TYPE so_obj_edt,
L_FILE1(100).
CONCATENATE 'C:\' sy-repid '_' sy-datum '.XLS' INTO L_FILE1.
W_PATH-FILENAME = L_FILE1.
APPEND w_path.
CLEAR w_path.
wa_doc_chng-obj_descr = 'User List not logged on for 180 days'.
wa_doc_chng-obj_langu = 'E'.
wa_doc_chng-obj_expdat = sy-datum.
CLEAR w_subject.
CONCATENATE 'Please find attached document with list of users'
'not logged on for 180 days for client' sy-mandt
INTO w_subject SEPARATED BY space.
it_objtxt_basis-line = w_subject.
APPEND it_objtxt_basis.
CLEAR it_objtxt_basis.
it_objtxt_basis-line = text-004.
APPEND it_objtxt_basis.
CLEAR it_objtxt_basis.
CLEAR w_tab_line.
DESCRIBE TABLE it_objtxt_basis LINES w_tab_line.
READ TABLE it_objtxt_basis INDEX w_tab_line INTO l_cline.
wa_doc_chng-doc_size =
( w_tab_line - 1 ) * 255 + STRLEN( l_cline ).
CLEAR it_objpack_basis-transf_bin.
it_objpack_basis-head_start = 1.
it_objpack_basis-head_num = 0.
it_objpack_basis-body_start = 1.
it_objpack_basis-body_num = w_tab_line.
it_objpack_basis-doc_type = 'RAW'.
APPEND it_objpack_basis.
CLEAR it_objpack_basis.
LOOP AT w_path.
temp1 = w_path.
descr = w_path.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = descr
lang = 'E'
IMPORTING
rstring = descr.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
delimiter = '\'
string = descr
IMPORTING
head = descr
tail = temp_data.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = descr
lang = 'E'
IMPORTING
rstring = descr.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
delimiter = '.'
string = descr
IMPORTING
head = temp_data
tail = doc_type.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = temp1
filetype = 'BIN'
header_length = 0
read_by_line = 'X'
replacement = '#'
TABLES
data_tab = it_upload.
DESCRIBE TABLE it_upload LINES tab_lines.
DESCRIBE TABLE it_objbin_basis LINES lt_index.
lt_index = lt_index + 1.
LOOP AT it_upload.
wa_objbin_basis-line = it_upload-line.
APPEND wa_objbin_basis TO it_objbin_basis.
CLEAR wa_objbin_basis.
ENDLOOP.
it_objpack_basis-transf_bin = 'X'.
it_objpack_basis-head_start = 0.
it_objpack_basis-head_num = 0.
it_objpack_basis-body_start = lt_index.
it_objpack_basis-body_num = tab_lines.
it_objpack_basis-doc_type = doc_type.
it_objpack_basis-obj_descr = descr.
it_objpack_basis-doc_size = tab_lines * 255.
APPEND it_objpack_basis.
CLEAR it_objpack_basis.
ENDLOOP.
it_reclist_basis-receiver = '[email protected]'.
it_reclist_basis-rec_type = 'U'.
APPEND it_reclist_basis.
CLEAR it_reclist_basis.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_objpack_basis
contents_txt = it_objtxt_basis
contents_bin = it_objbin_basis
receivers = it_reclist_basis
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc EQ 0.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF.
ENDFORM. " send_list_to_basis
Reward points if useful
Regards
Anji -
How do I scan a photo to a file and then send the file as an attachment via email.
How do I scan a photo to a file and then send the file as an attachment via email.
All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
******Clicking the Thumbs-Up button is a way to say -Thanks!.******
**Click Accept as Solution on a Reply that solves your issue to help others**
Maybe you are looking for
-
RH Taking Long Time to Load/Blinking Cursor
Good morning, I am not for sure if this issue has been addressed but it is something I have run into multiple times on different versions of RH (currently on version 9). I have opened one of my RH projects and it is taking forever to "load" - I can c
-
Convert XML using XSLT mapping
Hi, I have an XML in the following format and would want to cnvert it in the target format shown below. Kindly let me know the XSLT mapping to conert from hierarchy to flat structure. <u><b>Source XML:</b></u> <group Level1="Mac Tools Item Classifica
-
Hello. I have a 2006 with 2 1242 APs connected to it. The problem I have is the 2 APs keep rebooting. they come up, get a DHCP address, stay up for a minute or so and restart. The log on the controller shows this each time it happens: Thu Apr 20 10:5
-
Hi All, I am trying to connect to sysbase tables with Connection String: <b>jdbc:sybase:TDS5:DB110:3400:falud002</b> JDBC Driver: <b>com.sybase.jdbc3.jdbc.SybDriver</b> But it gives me error in RWB as: <b>Error during database connection to the datab
-
Lr5 won't import nikon 5200 nef files.
My Lightroom 5 doesn't import my Nikon D5200 raw files.