‎2008 Dec 08 3:46 AM
Hi,all, when i call function SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail under unicode system, the format of contents in CONTENTS_BIN will be error, because the function will convert the contents. Any suggestion?
‎2008 Dec 08 4:30 AM
Hi Rick,
Instead of using the contents_bin for your attachment, use the contents_hex table to send the attachment .The contents need to be converted to binary form and pass into the packing list.
For this purpose, you can use the FMs 'SCMS_STRING_TO_XSTRING' and 'SCMS_XSTRING_TO_BINARY'.
Hope this helps solving your problem.
With regards,
Niharika Tejpal.
‎2008 Dec 08 3:53 AM
Otherwise, I want to put the content into CONTENTS_TXT, but functon will create a blank attachment for the content in CONTENTS_BIN despite there is no data. How to set the control table PACKING_LIST?
‎2008 Dec 08 4:30 AM
Hi Rick,
Instead of using the contents_bin for your attachment, use the contents_hex table to send the attachment .The contents need to be converted to binary form and pass into the packing list.
For this purpose, you can use the FMs 'SCMS_STRING_TO_XSTRING' and 'SCMS_XSTRING_TO_BINARY'.
Hope this helps solving your problem.
With regards,
Niharika Tejpal.
‎2008 Dec 08 4:40 AM
Hi Rick,
Trry this code.
refresh it_objbin.
refresh it_objpack.
refresh it_objtxt.
refresh it_reclist.
it_doc_chng-obj_name = 'SAPMAIL'.
it_doc_chng-obj_descr = 'Sub:Sending mail to SAP'.
append it_doc_chng.
it_objtxt = 'SAP Technical Consultant '.
it_objtxt = sy-uline.
append it_objtxt.
it_objtxt = 'UMA... This is the object text'.
append it_objtxt.
it_objbin = 'this is the title'.
append it_objbin.
it_objbin = 'this is the heading'.
append it_objbin.
describe table it_objtxt lines tab_lines.
read table it_objtxt index tab_lines into it_objtxt.
creating the entry for compressed document
it_objpack-transf_bin = ' '.
it_objpack-head_start = 1.
it_objpack-head_num = 0.
it_objpack-body_start = 1.
it_objpack-body_num = tab_lines.
it_objpack-doc_type = 'RAW'.
append it_objpack.
*----
Entering names in distribution list
*----
it_reclist-receiver = receiver.
it_reclist-rec_type = 'B'.
append it_reclist.
*----
Sending the document
*----
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = it_doc_chng
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
tables
packing_list = it_objpack
object_header = it_objhead
contents_bin = it_objbin
contents_txt = it_objtxt
receivers = it_reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
others = 8.
if sy-subrc = 0.
loop at it_reclist into it_reclist.
if it_reclist-retrn_code = 0.
message s001.
else.
message s002.
endif.
endloop.
else.
message s002.
endif.
refresh it_objpack.
clear it_objpack.
refresh it_objbin.
clear it_objbin.
The it_objbin will hold ur contenets of the mail.
Thanks,
Uma