2007 May 23 10:00 PM
Hi ,
I am having an issue ...with the FM so_new_document_att_send_api1 in 4.7 (used to email an attachment.)
In the excel attachement everything is in one line. I mean header and all the line records in one line. It doesn't show the line break.
But same program in 4.6 working fine
Does anybody know why is that?
Thanks,
Manish
2007 May 23 10:08 PM
See the code 4.7 and it is working well,compare the code with your's
data: output type ssfcrescl.
data : ssfctrlop type ssfctrlop.
data : ssfcompop type ssfcompop.
data : tab like mara occurs 0 with header line.
data : ar like docs occurs 0 with header line.
Smartform in OTF.
data : begin of t_otfdata occurs 0.
include structure itcoo.
data : end of t_otfdata.
To Get PDF.
data: t_lines like tline occurs 0 with header line.
Objects to send mail.
data: objpack like sopcklsti1 occurs 2 with header line.
data: objtxt like solisti1 occurs 10 with header line.
*DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
data: objbin like solix occurs 10 with header line.
data: reclist like somlreci1 occurs 5 with header line.
data: doc_chng like sodocchgi1.
data : objhead type soli_tab.
data : len_in like sood-objlen,
len_out like sood-objlen,
len_outn type i.
data righe_attachment type i.
data righe_testo type i.
To convert from 132 to 255.
*DATA: gd_buffer LIKE solix.
data: gd_buffer type string.
*DATA: gd_buffer(255) .
*DATA: it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE.
data: it_mess_att like solix occurs 0 with header line.
data: w_cnt type i.
tab-matnr = '1'.
append tab.
*t_otfdata[] = output-otfdata[].
Convert OTF to PDF (132 per line).
*call function 'CONVERT_OTF'
*exporting
*format = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
*importing
*bin_filesize = len_in
*tables
*otf = t_otfdata
*lines = t_lines.
Convert PDF from 132 to 255.
*loop at t_lines.
*translate t_lines using ' ~'.
*concatenate gd_buffer t_lines into gd_buffer.
*endloop.
*translate gd_buffer using '~ '.
*field-symbols : <fs> type any.
*data : st type solix.
*data : g1(255) .
*data : len type i.
*data : i type i.
*data : j type i.
*data : rows type i.
*data : l_rows type i.
*data : char type i.
*data : p type p decimals 2.
*i = 0.
*len = strlen( gd_buffer ).
*p = len / 255 .
*rows = floor( p ).
*char = abs( rows * 255 - len ).
*do.
*if sy-index le rows .
*g1 = gd_buffer+0(255).
*else.
*g1 = gd_buffer+0(char).
*endif.
*i = i + 254.
*assign g1 to <fs> casting type solix.
*st = <fs>.
*append st to it_mess_att.
*
*shift gd_buffer left by 255 places.
*if gd_buffer is initial.
*exit.
*endif.
*enddo.
*****
*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.
*
*len_outn = len_out = len_in.
*call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\Documents and Settings\vkulkarni\Desktop\zshl.xls'
filetype = 'BIN'
tables
data_tab = it_mess_att
.
len_outn = len_out = len_in.
clear: reclist, reclist[],
objhead, objhead[],
objtxt, objtxt[],
objbin, objbin[],
objpack, objpack[].
Object with PDF.
clear objbin.
refresh objbin.
objbin[] = it_mess_att[].
describe table objbin lines righe_attachment.
Object with main text of the mail.
objtxt = 'Test for 8D - Line 1'.append objtxt.
objtxt = 'Test for 8D - Line 2'.append objtxt.
objtxt = 'Test for 8D - Line 3'.append objtxt.
describe table objtxt lines righe_testo.
Document information.
doc_chng-obj_name = 'URGENT'.
doc_chng-expiry_dat = sy-datum + 10.
concatenate 'Alto Parana - Peticion de Oferta' 'test'
into doc_chng-obj_descr separated by space.
doc_chng-sensitivty = 'F'.
doc_chng-doc_size = righe_testo * 255.
Pack to main body.
clear objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = righe_testo.
objpack-doc_type = 'RAW'.
append objpack.
Pack to PDF.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = righe_attachment.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'TEST'.
concatenate 'test' '-' '123' '.pdf'
into objpack-obj_descr.
objpack-doc_size = righe_attachment * 255.
append objpack.
clear reclist.
reclist-copy = 'X'.
*for user to enter mail id
data v_mail type string.
call function 'CC_POPUP_STRING_INPUT'
exporting
property_name = 'Enter E-mail'
IMPORTING
VALUE_CHANGED =
changing
string_value = v_mail
.
e-mail receivers.
reclist-receiver = 'vkulkarni@rapidigm.com'.
reclist-express = 'X'.
reclist-rec_type = 'U'.
reclist-notif_del = 'X'. " request delivery notification
reclist-notif_ndel = 'X'. " request not delivered notification
append reclist.
Llamada a funcion de envio de mail.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_chng
put_in_outbox = 'X'
tables
packing_list = objpack
object_header = objhead
contents_hex = objbin
contents_txt = objtxt
receivers = reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
commit work.
if sy-subrc ne 0.
endif.
2007 Nov 13 7:03 AM
Hi Seshu,
The pdf attachment sent using the function module <b>so_new_document_att_send_api1</b> is not opening in the SAP outbox(tcode- so01).
I already have Acrobat readers installed in my machine.
Kindly let me know what could be problem.
Regards,
Mahalakshmi.Manne