10-19-2007 1:34 PM
Dear Friends,
Looking for sample program to send <b>SAP Script</b> output in PDF format to external mails while printing.
Regards,
Praveen Lobo
10-19-2007 1:36 PM
Hi Praveen,
Please check the FM so_document_send_api1. In the documentation u have a smaple program.
Thank you.
10-19-2007 1:39 PM
Hi,
better option is to convert your spool request to PDF and send it
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = mi_rqident
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.
then call FM after populating attachment data
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
10-19-2007 1:50 PM
Hello,
The problem in getting the spoolid while printing the SAP Script into order to send through external mail.
How i can identify a spool request for SAP script or is there any way to send the SAP Script output without refering to Spool ID
Regards,
Praveen Lobo
10-19-2007 1:40 PM
Hi,
Refer to the code in the following link:
http://www.sapdev.co.uk/reporting/rep_spooltopdf.htm
Hope this helps.
Reward if helpful.
Regards,
Sipra