FAX Sazpscript using SO_DOCUMENT_SEND_API1
Hi,
Im using SO_DOCUMENT_SEND_API1 FM to sned the sapscript thru fax...
I have just a question about the FROM and TO fields on the cover of the fax...
Currently my output has no value on the said fileds... I want to put values on those fields... How am I going to do that?
Thanks a lot!
check this link for all your querries
Re: SAPScript to email and fax
Please Check this one:
SAP Script->PDF->Email
have alook at this code also
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
also u can chk sample programe.
Refer to the code in the following link:
http://www.sapdev.co.uk/reporting/rep_spooltopdf.htm
do reward if helpful
Similar Messages
-
Sending HTML Mails using SO_DOCUMENT_SEND_API1
Dear all,
we were using SO_DOCUMENT_SEND_API1 to send plain text e-mail replies to participants of an incentive program. Now the customer wants to send HTML mails. Customer has provided HTML templates for the mails, and the text always is the same, only slight changes in regard to the particpants number occur. Has anybody ever performed sending HTML formated mails without using SmartForms?
Thanks for your help!
Kind Regards
ChrisSure.. here is a sample program.
report zrich_0002.
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
perform build_text_message.
perform build_receivers.
perform send_mail_nodialog..
* Form BUILD_TEXT_MESSAGE
form build_text_message.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
mailtxt = '<html>'.
append mailtxt.
mailtxt = '<head>'.
append mailtxt.
mailtxt = '<title>Untitled Document</title>'.
append mailtxt.
mailtxt = '<meta http-equiv="Content-Type" content="text/html;'.
append mailtxt.
mailtxt = 'charset=iso-8859-1">'.
append mailtxt.
mailtxt = '</head>'.
append mailtxt.
mailtxt = '<body>'.
append mailtxt.
mailtxt = '<div align="center"><em><font' .
append mailtxt.
mailtxt = 'color="#0000FF" size="+7" face="Arial,'.
append mailtxt.
mailtxt = 'Helvetica, sans-serif">THIS'.
append mailtxt.
mailtxt = ' IS A TEST </font></em><font' .
append mailtxt.
mailtxt = 'color="#0000FF" size="+7" face="Arial,'.
append mailtxt.
mailtxt = 'Helvetica, sans-serif"></font>'.
append mailtxt.
mailtxt = '</div>'.
append mailtxt.
mailtxt = '</body>'.
append mailtxt.
mailtxt = '</html>'.
append mailtxt.
endform.
* Form BUILD_RECEIVERS
form build_receivers.
* mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
endform.
* Form SEND_MAIL_NODIALOG
form send_mail_nodialog.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
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.
Regards,
Rich Heilman -
How to send CC email using SO_DOCUMENT_SEND_API1
Hi,
How to send CC email using SO_DOCUMENT_SEND_API1. Any sample code is very much appreciated.
CheersPlease check In this function there is a flag in RECEIVERS table for sending mail as COPY or BLIND COPY
a® -
Problem while updating Tel no and Fax no using BAPI_BUPA_ADDRESS_CHANGE
Hi,
Im trying to update the Telephone number and Fax number using a BAPI but unable to update in Tcode BP .can you please tell teh solution.my code is below.
data : i_tel like BAPIADTEL occurs 0 with header line,
i_fax like BAPIADFAX occurs 0 with header line,
i_telx like BAPIADTELX occurs 0 with header line,
i_faxx like BAPIADFAXX occurs 0 with header line.
i_tel-telephone = '800-266-3377'.
append i_tel.
i_fax-fax = '505-796-9601'.
append i_fax.
i_telx-telephone = 'X'.
append i_telx.
i_faxx-fax = 'X'.
append i_faxx.
To add Telephone number and FAX number
CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
EXPORTING
businesspartner = '0007000006'
TABLES
BAPIADTEL = i_tel[]
BAPIADFAX = i_fax[]
BAPIADTEL_X = i_telx[]
BAPIADFAX_X = i_faxx[].
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
if sy-subrc =0.
write:/5 'Successfully updated'.
endif.
Regards,
Deepthi.DATA : i_tel LIKE bapiadtel OCCURS 0 WITH HEADER LINE,
i_fax LIKE bapiadfax OCCURS 0 WITH HEADER LINE,
i_telx LIKE bapiadtelx OCCURS 0 WITH HEADER LINE,
i_faxx LIKE bapiadfaxx OCCURS 0 WITH HEADER LINE,
i_return LIKE bapiret2 OCCURS 0 with header line.
i_tel-telephone = '800-266-3356'.
APPEND i_tel.
i_fax-fax = '505-796-9656'.
APPEND i_fax.
i_telx-telephone = 'X'.
i_telx-updateflag = 'I'.
APPEND i_telx.
i_faxx-fax = 'X'.
i_faxx-updateflag = 'I'.
APPEND i_faxx.
To add Telephone number and FAX number
CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
EXPORTING
businesspartner = '0007000006'
TABLES
bapiadtel = i_tel[]
bapiadfax = i_fax[]
bapiadtel_x = i_telx[]
bapiadfax_x = i_faxx[]
return = i_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IF sy-subrc = 0.
WRITE:/5 'Successfully updated'.
ENDIF.
data:v_msg(255) type c.
loop at i_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = i_return-id
LANG = 'EN'
NO = i_return-number
V1 = i_return-message
IMPORTING
MSG = v_msg
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2 .
write:/5 v_msg.
endloop. -
Multiple pdf attachments from server folder using SO_DOCUMENT_SEND_API1
Dears,
I am trying to build a program able to send an email with multiple pdf attachments.
The files are stored in a folder in SAP server.
I am able to generate a pdf file from a spool and sucessfully attach it to the email using:
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc = 0.
LOOP AT it_lines.
TRANSLATE it_lines USING ' ~'.
CONCATENATE gd_buffer it_lines INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att_aux = gd_buffer.
APPEND it_mess_att_aux.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDIF.
Internal table it_mess_att_aux is the parameter contents_bin of FM SO_DOCUMENT_SEND_API1.
I have now 2 files on a server folder which I would like to include as well.
I am reading the content of the pdf files in following way:
DATA: gd_buffer TYPE string,
OPEN DATASET lv_fileserver FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE e257(zmsgsd) WITH lv_fileserver.
ELSE.
CLEAR: it_mess_att_aux[], gd_buffer.
DO.
READ DATASET lv_fileserver INTO gd_buffer.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND gd_buffer TO it_mess_att_aux.
ENDDO.
APPEND LINES OF it_mess_att_aux TO it_mess_att.
I do not understand the purpose of the statement:
TRANSLATE it_lines USING ' ~'.
in this context. Could anyone explain it?
All the files are attached to email with the desired name but corrupted and with the wrong size.
Can anyone help me build the logic to attach a pdf file from server in a email?
Thank you in advance,
Kind Regards,
João Cabritahi , try this ,it is working fine .
DATA: i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
* wa_doc_chng LIKE sodocchgi1,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
* i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
wa_doc_chng LIKE sodocchgi1,
v_lines_txt TYPE i,
l_lines TYPE I VALUE '20'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = bin_filesize
TABLES
otf = int_tab_otf_final
lines = int_pdf_tab.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*****************soc ranjan***************************
* IF full_path IS INITIAL.
* CALL METHOD cl_gui_frontend_services=>file_save_dialog
* EXPORTING
** WINDOW_TITLE =
** DEFAULT_EXTENSION = 'PDF'
** DEFAULT_FILE_NAME =
* file_filter = 'Portable Document Format (.pdf)' " for restricting saving file only as pdf
* CHANGING
* filename = file_name
* path = file_path
* fullpath = full_path
* 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.
******************eoc ranjan*****************
*break-point.
CONCATENATE full_path git_select_option-pernr INTO path SEPARATED BY '_'.
CONCATENATE path 'PDF' INTO path SEPARATED BY '.'.
** **************************for downloading*********************************
* CALL FUNCTION 'GUI_DOWNLOAD'
* EXPORTING
* bin_filesize = bin_filesize
* filename = path
* filetype = 'BIN'
* IMPORTING
* filelength = file_size
* TABLES
* data_tab = int_pdf_tab.
* IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
CLEAR : lop , el , sl , cl .
* ******************addeddd later by ranjan 21.04.2011
DATA : desc TYPE char40 ,
desc1 TYPE char100 .
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = int_pdf_tab
t_target_tab = i_record
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE : / 'Error in conversion of pdf lines'(015).
ENDIF.
APPEND LINES OF i_record TO i_objbin.
*Creation of the entry for the compressed attachment
DESCRIBE TABLE i_objbin LINES bin_filesize.
i_objtxt = 'Hi'.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = 'Pls find the attached salary slip ' .
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = 'Regards: '.
APPEND i_objtxt.
i_objtxt = 'Corporate HR '.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES L_LINES.
READ TABLE i_objtxt INDEX L_LINES.
wa_doc_chng-doc_size = ( L_LINES - 1 ) * 255 + STRLEN( i_objtxt ).
*Creating the entry for the compressed document
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = L_LINES.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
***CLEAR: i_objpack .
***i_objpack-transf_bin = ' '.
**i_objpack-head_start = 1.
**i_objpack-head_num = 0.
**i_objpack-body_start = 1.
**i_objpack-body_num = L_LINES.
**i_objpack-doc_type = 'TXT'.
**i_objpack-obj_descr = desc1 .
**APPEND i_objpack.
*CLEAR: i_objhead .
*i_objhead = DESC.
*APPEND i_objhead.
*break-point .
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = bin_filesize.
i_objpack-obj_name = 'Employee Payslip'.
i_objpack-obj_descr = 'Employee Payslip'.
i_objpack-doc_size = bin_filesize * 255 .
i_objpack-doc_type = 'PDF'.
APPEND i_objpack.
CONCATENATE 'Salary Slip of Month' p_month INTO desc SEPARATED BY ' ' .
*DESCRIBE TABLE i_objtxt LINES v_lines_txt.
*READ TABLE i_objtxt INDEX v_lines_txt.
****wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 375 + STRLEN( i_objtxt ).
wa_doc_chng-obj_name = 'Payslip'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = desc.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
CLEAR i_objpack.
DATA: l_usrid_long TYPE pa0105-usrid_long.
DATA : emessage(70) TYPE c.
CLEAR : l_usrid_long.
SELECT SINGLE usrid_long
FROM pa0105
INTO l_usrid_long
WHERE pernr = git_pa0001-pernr
AND subty = '0010'.
*break-point.
IF sy-subrc EQ 0.
i_reclist-receiver = l_usrid_long.
i_reclist-rec_type = 'U'.
i_reclist-com_type = 'INT'.
APPEND i_reclist.
ELSE.
WRITE:/ 'No email id is maintained for this personnel number' , git_pa0001-pernr.
ENDIF.
IF NOT i_reclist[] IS INITIAL.
***************************************for senders id *************************************
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
sender_address = 'xys'
sender_address_type = 'SMTP'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_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 SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to set up fax solution using Windows 2008 R2 Fax server role and Exchange 2007
Hello,
I don't know if this is the right forum to post this but since it is related to Exchange I thought it might be. If this is not the right place, please direct me to the forum where my post would be more appropriate.
I'm looking to set up a Fax solution for the company that I work for as we are moving away from analog phone lines to VoIP using SIP. My original thought was to set up a Windows 2008 R2 server with Fax server role installed and have it route the fax message
to Exchange 2007 SP3 so the fax message can be delivered to each user's inbox. I was reading a little bit on the Windows Fax server role and from what I saw it looks like it can only route fax messages to one email address. This not ideal for my company. Is
there a way to have the fax server role route the email to each user's inbox? If so, how can I achieve this?
How can implement this for this sending outgoing faxes as well?
I don't know if this releveant or not but I will be using Asterisk as a media gateway between our SIP trunks and the Windows Fax server.
Any help is appreciated. Thanks!Please find the below url for the complete Fax configuration in Exchange 2007 Unified Messaging
http://blogs.technet.com/b/exchange/archive/2007/04/18/3401950.aspx
The article is so easy to understand with detail procedure and guideliness
Exchange Queries -
Problem in mailing smartforms output using SO_DOCUMENT_SEND_API1
Hi all,
Iam using the function module SO_DOCUMENT_SEND_API1 to email purchase order through driver program.
the code goes like this:
first iam calling the function module of smartform
CALL FUNCTION lv_fm_name
where iam passing the desired paramets.
from where iam taking the otfdata returned from the fm
like:
IMPORTING
job_output_info = w_return
where w_return is declared as TYPE ssfcrescl.
then iam writing this code
i_otf[] = w_return-otfdata[].
DELETE w_return-otfdata WHERE tdprintcom = '//'.
READ TABLE i_otf WITH KEY tdprintcom = 'EP'.
my_tabix = sy-tabix + 1.
INSERT lines of w_return-otfdata INTO i_otf INDEX my_tabix.
then iam calling the fm
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
then converting it to 255 using
DATA: gd_buffer TYPE string.
DATA: w_cnt TYPE i,
i_record LIKE solix OCCURS 0 WITH HEADER LINE.
LOOP AT i_tline.
TRANSLATE i_tline USING ' ~'.
CONCATENATE gd_buffer i_tline INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
i_record-line = gd_buffer.
APPEND i_record.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
the to test whether its converting into pdf iam using the fm
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = 'C:\TESTPDF.PDF'
filetype = 'BIN'
TABLES
data_tab = i_record.
then calling my main fm
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
sender_address = sender
sender_address_type = 'INT'
commit_work = 'X'
TABLES
packing_list = it_packing_list
object_header = w_objhead
CONTENTS_BIN = I_OBJBIN
contents_txt = i_objtxt
contents_hex = i_objbin
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
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
all the parametrs for the above fm are passed correctly like populating it_packing_list,w_objhead, i_objtxt, i_objbin,it_receivers.iam using this fm because i need to pass sender email id.
the first problem iam facing is when iam using the fm gui_download iam not able to view the smartform
the error is "adobe reader could not open "test.pdf" as it is not supported etc..."
second is same problem iam facing while trying to open the attachment in pdf which is emailed to reciever.
i think there is some problem in converting 132 to 255 characters.
can some one please help on this.(might be a problem where iam passing DO
i_record-line = gd_buffer.)
thanks in advance.
regards
sunilCALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = <b>255 "132</b>
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
I guess it will solve your problem.
CLose the thread if your question is answered.
Regards,
SaiRam -
How to format body message while using SO_DOCUMENT_SEND_API1?
hi,
i am having some data in internal table that i want to format as text message and mail through SO_DOCUMENT_SEND_API1 function module but not as a attachement. i am using contents in body message. but i am not able to do formating , is there any way ?
internal table:
claimid claimdate expensetype amount
0001 01.06.2008 FUMD 20000
0002 02.06.2008 SUND 500
0003 05.06.2008 ENTM 1500
i want to print this in message body part and send it throgh mail, while using write statement , it takes lot time.
plz suggest me.
Saurin ShahHi
Take a table as mentioned below.
GT_OBJTXT LIKE SOLISTI1
OCCURS 0 WITH HEADER LINE, " Mail Text options
and populate the data that you want to print as body in this table line by line.
Formating/allignment only can be done while populating the table. U have to check the mail and keep adjusting the allignment.
And after populating send the table to one table parameter in funciton module that is...
CONTENTS_TXT = LT_OBJTXT.
This will populate the mail body.
<REMOVED BY MODERATOR>
Venkat.
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 2:17 PM -
Sending mails to Internal SAP ID using SO_DOCUMENT_SEND_API1!!
Hi
I was trying to send mail using fm SO_DOCUMENT_SEND_API1 but why problem is the internal table that needs to be passed has (contets bin ) has only 255 chars ...
but my data sets are huge and i need to send all of them in mail..so the remaining data is not getting reflected in the excel file....
whats the way out?
CONTENTS_BIN STRUCTURE SOLISTI1 OPTIONAL
Points for sure
Regards
GunjanHi,
*& Report ZTESTMAIL *
REPORT ZTESTMAIL .
tables: bseg.
parameters: p_email type somlreci1-receiver default
'[email protected]'.
data: it_message type standard table of solisti1 initial size 0
with header line.
data: it_attach type standard table of solisti1 initial size 0
with header line.
DATA: begin of int_bseg occurs 0,
zuonr like bseg-zuonr,
end of int_bseg.
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,
gd_error type sy-subrc,
gd_reciever type sy-subrc.
*START_OF_SELECTION
start-of-selection.
Retrieve sample data from table ekpo
perform data_retrieval.
Populate table with detaisl to be entered into .xls file
*perform build_xls_data_table.
*END-OF-SELECTION
end-of-selection.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
perform send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Assignment Date after 2 days'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select zuonr from bseg into corresponding fields of int_bseg.
endselect.
DATA: begin of int_bseg1 occurs 0,
zuonr1 like bseg-zuonr,
end of int_bseg1.
loop at int_bseg.
int_bseg1-zuonr1 = int_bseg-zuonr.
endloop.
endform. " DATA_RETRIEVAL
*& 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 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[] = 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 it_message lines t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
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
object_header = t_object_header
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.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
refresh it_message.
it_message = 'Assignment Date is coming After 2 Days Please check doc.'.
append it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
Reward if helpfull
Regards,
Nandha -
Problems sending mail with txt attachtment using SO_DOCUMENT_SEND_API1 MF
Hi gurus,
I allready tried to search in the forum some threads related with my problem, but i couldnt found any with the same problem that im having.
My problem it's when attachting an txt file, using MF SO_DOCUMENT_SEND_API1 MF, the mail attachtment it's coming with the txt file but instead of coming with the all lines in the contents_bins table the file it's coming with a few lines. I think the problem it's that the txt file should come with 80 characters per line, like it's on the contents_bin table, buu instead that the MF it's filling me each line of the file with 1024 characters.
Does anyone has ideas what im doing wrong?
Ps - Below goes my code.
Thanks in Advance,
Best Regards,
João Martins.
CLEAR contents_bin.
REFRESH contents_bin.
PERFORM get_attachment TABLES tab_movimentos contents_bin
USING linha_inicial
linha_final.
CLEAR: document_data, tab_lines.
MOVE 'Aviso Ficheiro Retorno' TO document_data-obj_descr.
MOVE 'Aviso Ficheiro de Retorno TU' TO document_data-obj_name.
DESCRIBE TABLE contents_txt LINES tab_lines.
READ TABLE contents_txt INDEX tab_lines.
document_data-doc_size = ( tab_lines - 1 ) * 255
+ STRLEN( contents_txt ).
CLEAR packing_list.
REFRESH packing_list.
packing_list-transf_bin = space.
packing_list-head_start = 1.
packing_list-head_num = 0.
packing_list-body_start = 1.
DESCRIBE TABLE contents_txt LINES packing_list-body_num.
packing_list-doc_type = 'RAW'.
APPEND packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 1.
packing_list-head_num = 1.
ADD 1 TO tab_lines.
packing_list-body_start = tab_lines.
CLEAR: lv_filename, tab_lines.
CONCATENATE 'Fich Retorno -' nome_ficheiro INTO lv_filename.
DESCRIBE TABLE contents_bin LINES tab_lines.
packing_list-doc_type = 'TXT'.
packing_list-obj_descr = 'Ficheiro Retorno'.
packing_list-obj_name = lv_filename.
packing_list-doc_size = tab_lines * 255.
APPEND packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
put_in_outbox = 'X'
sender_address = 'SIFJOB'
sender_address_type = 'B'
IMPORTING
sent_to_all = sent_to_all
TABLES
packing_list = packing_list
contents_bin = contents_bin
contents_txt = contents_txt
receivers = tab_receiver
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.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = SPACE
AND RETURN.
FORM get_attachment TABLES p_tab_movimentos STRUCTURE
zlinha_movimentos_fich_retorno
p_contents_bin STRUCTURE contents_bin
USING p_linha_inicial STRUCTURE
zlinha_inicial_ps2
p_linha_final STRUCTURE
zlinha_final_ps2.
DATA: lv_valor(14).
DATA : line(80) TYPE x.
CONCATENATE p_linha_inicial-referencia p_linha_inicial-tipo_registo
p_linha_inicial-tipo_operacao p_linha_inicial-situacao_conta
p_linha_inicial-situacao_registo p_linha_inicial-iban+4(21)
p_linha_inicial-moeda p_linha_inicial-data_pag
p_linha_inicial-ref_ordenante p_linha_inicial-filler
INTO p_contents_bin-line.
CLEAR line.
conv_bin p_contents_bin-line line.
MOVE line TO p_contents_bin-line.
APPEND p_contents_bin.
CLEAR p_contents_bin.
LOOP AT p_tab_movimentos.
CLEAR: lv_valor.
WRITE p_tab_movimentos-montante TO lv_valor.
PERFORM normalize_value USING lv_valor.
CONCATENATE p_tab_movimentos-referencia
p_tab_movimentos-tipo_registo p_tab_movimentos-tipo_operacao
p_tab_movimentos-sit_conta_retor p_tab_movimentos-situacao_registo
p_tab_movimentos-nib lv_valor
p_tab_movimentos-ref_ordenante p_tab_movimentos-filler
INTO p_contents_bin-line.
CLEAR line.
conv_bin p_contents_bin-line line.
MOVE line TO p_contents_bin-line.
APPEND p_contents_bin.
CLEAR p_contents_bin.
ENDLOOP.
CLEAR: lv_valor.
WRITE p_linha_final-mont_total TO lv_valor.
PERFORM normalize_value USING lv_valor.
CONCATENATE p_linha_final-referencia p_linha_final-tipo_registo
p_linha_final-tipo_operacao p_linha_final-filler_1
p_linha_final-situacao_registo p_linha_final-filler_2
p_linha_final-total_reg lv_valor
p_linha_final-filler INTO p_contents_bin-line.
CLEAR line.
conv_bin p_contents_bin-line line.
MOVE line TO p_contents_bin-line.
APPEND p_contents_bin.
CLEAR p_contents_bin.
ENDFORM. " get_attachmentHi,
I've solved this problem. The problem was because i was using the
* Anexo - Descrição
packing_list-transf_bin = 'X'.
packing_list-head_start = 1. "Here it must be 0 because i wasn't using any table header
packing_list-head_num = 0.
ADD 1 TO tab_lines.
packing_list-body_start = 1.
CLEAR: lv_filename, tab_lines.
CONCATENATE nome_ficheiro 'TB' INTO lv_filename.
* CONCATENATE 'Fich Retorno -' nome_ficheiro INTO lv_filename.
DESCRIBE TABLE contents_bin LINES tab_lines.
packing_list-doc_type = 'TXT'.
packing_list-obj_descr = lv_filename."'Ficheiro Retorno'.
packing_list-obj_name = lv_filename.
packing_list-body_num = tab_lines.
packing_list-doc_size = tab_lines * 255.
APPEND packing_list.
Best Regards
Thanks,
João Martins -
Excel attachment using SO_DOCUMENT_SEND_API1
Hi
I am using FM SO_DOCUMENT_SEND_API1 to send .XLS attachment from ABAP program.
I am using following code to calculate the size.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_size = t_packing_list-body_num * 255.
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
(I have posted only relevant code)
This was working fine in 4.7. But since upgrade to 6.0, the attachment is transferred only half the actual size.
i.e. if my internal table shows 4 records, the attachment in the mail shows only 2 records.
What can be done in this case. A simple solution would be to multiply the size by 2.
t_packing_list-doc_size = t_packing_list-body_num * 255 * 2.
This works, but does seem like a work around.
What could be the reason for this and what should be the solution?Hi,
I am also using 6.0 and similar logic is working fine to calculate the size. I think there must be some problem some where else in the code. Can you put your code that you have used.
Thanks & Regards
Rocky -
Sending attachment in a mail using SO_DOCUMENT_SEND_API1
Hi,
I am trying to send an attachment in a mail using the FM SO_DOCUMENT_SEND_API1.
The contents of the body and the attachement are same.
The contents of the body are coming in proper format but the attachements are not.
The body contents are in this way:
1000013559 0010004994 PBG BROOKF 1000013559 000100 010052000328667000 GA LQ CRE 20OZ 24CS FRT PUN 0.000 CS
1000013559 0010004994 PBG BROOKF 1000013559 000200 010052000328681000 GA LQ CRE 20OZ 24CS LL 0.000 CS
But the attachement contents are:
1000013559 0010004994 PBG BROOKF 1000013559 000100 010052000328667000 GA LQ CRE 20OZ 24CS FRT PUN
⸀ 䌀匀ഀ u2020
1000013559 0010004994 PBG BROOKF 1000013559 000200 010052000328681000 GA LQ CRE 20OZ 24CS LL
⸀ 䌀匀ഀ u2020
Also the last 2 fields which are quantity and unit fields, are not coming at all in the attachment.
Please help me solve this issue.
Thanks,
Abhishekwhat is the document type of attachment? is it excel?
-
I can't fax anymore using Fax STF 5.1 in Classic 9.2.1
I have always been able to fax by way of my Epson Stylus Scan 2000. I just reinstalled all the software and upgraded my G3 computer to 10.1.5. When in Classic, I now can't fax. The icon in the Fax Monitoring screen is a serial port. I checked everything to make sure that the modem selected is not a pinter port. Everything selected says internal modem port. So my question is why can't I fax and how can I change the serial port icon to a phone modem icon.
Leslie,
Sorry for the confusion...I just wanted to make sure what OS you had booted. When OSX is the booted OS, and OS 9.x is also running inside OSX so you can still use 9.x applications, "Classic" is the term used to describe 9.x.
It has been too long since I have worked with 9.x to be helpful without doing some homework, so I would head over to the MacOS 9 Discussions for some excellent help.
http://discussions.apple.com/forum.jspa?forumID=669 -
Fax line used for outgoing calls when incomming fax not coming in?
So is there a way to do this? Can I route the 1 FXO to FXS for incomming calls (and plug fax into FXS) or something like this and then use that line as an outgoing line when not in use?
I don't need step but steps but the basics of how something like this could be configured would be awesome!!!I'm not sure if I understand. I set this up, so I understand phone systems enough to do this, but I don't really don't know the terminoligy.
Let me back up.
Currently our business has 2 lines and a fax line. Right now the two lines are plugged into 2 FXO ports and the fax line is just plugged into the fax machine--not the UC320. We're in mixed mode, not pbx specifically. We get one or two faxes a day and we send two or 3 faxes a day. We'd like to be able to use the fax line for outgoing calls when it's not being used for fax.
So I need to be able to control the in and the out of the fax line. I need all incomming calls for the fax number routed to what I assume would be the FXS port (with the fax machine plugged into the FXS port), and none of the other lines routed in this way (the other lines would go to the attendant).
Then I need if we send a fax, we need for when the fax machine opens the line for it to automatically be routed to the fax line. Then the fax machine can dial and send faxes. I think we send few enough faxes that we're not too worried about what happens if we try to send a fax and the phone is busy, but it would be nice to be able to look at a phone and tell if the fax line is in use.
I don't really care if the Fax line is part of a shaed FXO, it can be a seperate choice on the phone for making outgoing calls (one of the buttons next to the screen or something).
Is all this possible? Is it only possible in PBX style or is mixed ok? -
Low fax quality using fax as a system printer
1. The fax quality and resolution using the original setup as a printer is very low.
I can't see the reason because it's all done without printing, a digital file format tranforming.
2. How can I approach the fax manager not when printing a new fax?Hey there @Kroi!
Thank you for posting on the HP Forums!
I would be happy to provide some help regarding your Officejet 4500 and the fax resolution. On the printer you should be able to set the fax resolution to fine or very fine and make the fax lighter or darker. Once those settings are inputted you should be able to save them as a default on the printer.
To change the fax settings press the fax icon on the printer. In the fax menu you should be able to scroll to fax resolution and press OK. Under fax resolution you should be able to choose from fine, very fine, photo and standard. I recommend choosing fine or very fine. You should then be able to scroll to lighter/darker to adjust those settings. Once the settings are set scroll to "Set New Default and confirm.
Test by sending a fax and see how it goes!
Thanks again for posting and have a great day!
Cbert
I work on behalf of HP.
Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos, Thumbs Up" at the bottom of this post to say “Thanks” for helping!
Maybe you are looking for
-
How to aggregate a KF in BEX which is an attribute of a InfoObj (avoiding sum)?
Hi all, i've a requirement in a report that now I'll try to explain in detail. We have a attribute (ZCOST) of a new infoobject (ZVEND) that i need to use in a new report using BEx analyzer (we have BI 7.3), the attribute ZCOST is a currency and an ex
-
How can I create paragraph rules below a heading in InDesign CS5?
I have created a rule but the headings are appearing sometimes with a rule both above and below and sometimes only below...the display is inconsistent. I'd be very happy if someone could tell me what I'm doing wrong here. Here is a screenshot - note
-
Most of the time when I export photos by email, it fails
Most of the time, but not all, when exporting photos by email, it takes a long time then fails, how do I fix?
-
Dynamic LOV's - can we display more than one field in the Select list.
I have the following query. SELECT DISTINCT NAME d, legal_entity_id r FROM xle_entity_profiles ORDER BY NAME So the drop down would contain the Organizational Name - say in the case China mobilex The legal entity id is - 100 Issue, there's also a
-
How to create a BOM without default warehouse on 8.82
Hi Expert, I have several item will make on 2 warehouse at same day for ship to different area. original I created to 2 different item code and 2 BOM for those 2 warehouse. on forecast, I set those 2 item code , after MRP running, 8.8 will let me k