04-13-2010 12:24 PM
Hi All,
I am developing a program for sending a mail in .TXT format using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
The Mail is getting successfully send with the attachment, but inside the file its coming as say for e.g.V i c k y k u m a r " , " 3 4 0 0 1 8 2 7 instead of "Vicky kumar","34001827". Can you please let me know why its coming in this way.
Below is the table where i am passing the data to li_objbin for the attachment.
LOOP AT TAB_105_FNL.
CONCATENATE wa_error-pernr wa_error-desc INTO lwa_objbin SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
lwa_objbin = TAB_105_FNL.
CONCATENATE cl_abap_char_utilities=>newline lwa_objbin
INTO lwa_objbin.
APPEND lwa_objbin TO li_objbin.
CLEAR lwa_objbin.
ENDLOOP.
lwa_objhead = 'Employee_Mass_Data.xls'.
APPEND lwa_objhead TO li_objhead.
lwa_objpack-transf_bin = 'X'.
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
lwa_objpack-body_start = 1.
lwa_objpack-body_num = LINES( li_objbin ).
lwa_objpack-doc_type = 'DAT'. " Here I tried with TXT also but still its is working the same way
lwa_objpack-obj_name = 'ATTACHMENT'.
lwa_objpack-obj_descr = 'Employee Mass Data'.
lwa_objpack-doc_size = lwa_objpack-body_num * 255.
APPEND lwa_objpack TO li_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lv_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_reclist
Thanks and Regards,
Salish
04-14-2010 4:46 AM
Hello Salish,
If i understand correctly you are getting the text file in this format because you have passed the attachment as a BIN object.
Can you please explain why you are doing so ?
BR,
Suhas
04-13-2010 12:48 PM
Hi Salish,
Try this way:
CONSTANTS : c_raw(3) TYPE c VALUE 'RAW'
if lwa_objpack-doc_type = 'TXT'.
it_objpack-doc_type = C_RAW.
endif.
or directly assign C_RAW
Secondly you can use function READ_TEXT. Have a try with this too.
04-14-2010 4:18 AM
Hi,
Thanks for the reply but when i tried with RAW the output file is coming with some invalid characters as follows:
"Vicky kumar","34001827","00000000","APVYK00",123456,"IN14","1","MJ","01502000",CP:India-Mumbai Head Office,"Vicky_kumar@colpa
氀⸀挀漀洀u2200
Can you please let me know why this is coming.
Thanks
Salish.
04-14-2010 4:46 AM
Hello Salish,
If i understand correctly you are getting the text file in this format because you have passed the attachment as a BIN object.
Can you please explain why you are doing so ?
BR,
Suhas
04-14-2010 7:12 AM
Hi Suhas,
If I do not pass BIN value as X then it takes contents_txt = li_objtxt (see in the parameters of the FM) as the attachment.
I mean the data in the context_txt is seen in the attachment.
Thanks
Salish.
04-14-2010 9:21 AM
Suhas meant (I guess) that you passed your text to CONTENTS_BIN instead of CONTENTS_TXT
04-14-2010 9:24 AM
04-14-2010 10:14 AM
Hi Suhas,
Thanks for the Reply...It is getting fine now. But there is one more thing, In the mail part i have to write someting in the body, since I was writing the body in the context_txt part, now where should i have to write now??
Thanks
Salish.
04-14-2010 10:27 AM
First context_txt part is considered to be the body, and the following context_txt parts are considered as attachments.
04-14-2010 11:50 AM
Hi all,
Thanks for your help, the problem is solved now and also points has been rewarded. Again thank you for the quick response.
Thanks,
Salish
11-28-2010 5:56 PM
Hi Salish,
I am facing the same issue in sending text file as attachment, Can you please help.
Regards
Manu
04-14-2010 7:27 AM
04-14-2010 10:42 AM
in the context_txt tables parameters pass the first table line in li_objtxt is for the email body and the second append should be for attachment text in li_objtxt,
04-14-2010 11:17 AM
Hi,
use function Module ''SCMS_TEXT_TO_BINARY'' and pass 'contents_bin' to it before calling 'SO_NEW_DOCUMENT_ATT_SEND_API1'. This will align the content of text attachment.
Thanks
Amol
04-14-2010 4:56 PM
Check out this easy e-mail routine: [http://lucattelli.com/blog/?page_id=478|http://lucattelli.com/blog/?page_id=478]