03-22-2006 3:14 AM
Hi All,
I am using function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send a tab delimeted text file with an email. Email goes fine but when I open the file the format is not tab delimited. Well the fields are delimited by tabs but new record does not start on a new line rather it starts on the same line and I think after 255 characters.
I am assuming that it is because I am using binary flag = 'X' but if I send this flag as blank then no data gets generated in the file.
Does anyone know what the problem could be. Can we send the file as anything other than binary.
Also, can we send more than one attachment in one email?
data: objpack like sopcklsti1 occurs 0 with header line,
objhead like solisti1 occurs 0 with header line,
objbin like solisti1 occurs 0 with header line,
objtxt like solisti1 occurs 0 with header line,
reclist like somlreci1 occurs 0 with header line,
doc_chng like sodocchgi1,
tab_lines like sy-tabix,
l_num(3).
records = 0.
describe table download_file lines records.
doc_chng-obj_name = 'SEND_EMAIL'.
doc_chng-obj_descr = 'GLPCA Reclass Data'.
if records > 0.
objtxt = 'Attached file contains GLPCA Reclass data.'.
append objtxt.
clear objtxt.
objtxt = 'Please double click the attachment to verify data.'.
append objtxt.
clear objtxt.
else.
objtxt = 'No data found.'.
append objtxt.
clear objtxt.
endif.
describe table objtxt lines tab_lines.
read table objtxt index tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
Creation of the entry for the compressed document
clear objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
append objpack.
clear objpack.
Creation of the entry for the compressed attachment
if records > 0.
loop at download_file.
move download_file to objbin.
condense objbin.
append objbin.
clear objbin.
endloop.
describe table objbin lines tab_lines.
objhead = b_file.
append objhead.
clear objhead.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'txt'.
objpack-obj_name = 'SEND_EMAIL1'.
objpack-obj_descr = 'Download File'.
objpack-doc_size = tab_lines * 255.
append objpack.
clear objpack.
endif.
Completing the recipient list For sending mail to Internet Address
reclist-receiver = email.
reclist-rec_type = 'U'.
append reclist.
clear reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = doc_chng
TABLES
PACKING_LIST = objpack
OBJECT_HEADER = objhead
CONTENTS_BIN = objbin
CONTENTS_TXT = objtxt
RECEIVERS = reclist
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
Thanks for your help.
03-22-2006 4:32 AM
Hi aurang,
1. from where are u getting the
data of the file (tab delmited file)
2. are u constructing by your own logic,
or are u uploading from front-end server / application server ?
regards,
amit m.
03-22-2006 5:00 AM
Hello Amit,
I am also facing the same problem what Aurang khan has described. The attachment data is created by my own logic, saving in an internal table (of type SOLISTI1) and then passing this internal table as table-type parameter to the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
Any solution to the problem?
03-22-2006 2:12 PM
Hi Amit,
Thanks for the response. I have data in an internal table called download_file. Data is in a tab delimited form in this table as this table contains only one field of length 100 characters. In the code above I am moving all the data from download_file to the objbin table which has a field of length 255.
When the file is sent with an attachment the data seems like it's not broken by lines. Is it because of the binary transfer?
Thanks
Aurang
06-01-2006 2:57 PM
Hi Anurag,
I am also having the same problem.The formatting of the file is not proper.
The first record comes fine but the next records are distorted.
Please tell me the solution which u got.
Thanks in Advance.