‎2012 Jul 03 12:30 PM
I am using SO_NEW_DOCUMENT_SEND_API1 to send an email My requirement is to send a text line as the email body. But in my email, there is no body coming and a an attached text file is coming with that text. Please check the code below and let me know what to so.
****************************************************
DATA: listobject LIKE abaplist OCCURS 0 WITH HEADER LINE.
DATA: i_mailpakketje LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
i_mailheader LIKE solisti1 OCCURS 1 WITH HEADER LINE,
i_object LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_mailtekst LIKE solisti1 OCCURS 10 WITH HEADER LINE,
i_ontvanger LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: h_true TYPE c.
DATA: h_boodschap(40) TYPE c.
DATA: OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA: user_address LIKE sousradri1 OCCURS 1 WITH HEADER LINE.
DATA: sent_to_all LIKE sonv-flag.
************************************************
* Create the document which is to be sent
CONCATENATE 'Foutmelding Content Server: ' sy-sysid
INTO h_boodschap SEPARATED BY space.
doc_chng-obj_descr = h_boodschap.
* Mail body text
APPEND 'Fout opgetreden bij opvragen plaatje!' TO i_mailtekst.
i_ontvanger-receiver = 'PAL.SUBHAJIT@GMAIL.COM'.
i_ontvanger-rec_type = 'U'.
i_ontvanger-express = 'X'.
i_ontvanger-notif_del = 'X'.
i_ontvanger-notif_read = 'X'.
i_ontvanger-notif_ndel = 'X'.
APPEND i_receivers.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_chng
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
object_content = i_mailtekst
receivers = i_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
*********************************
‎2012 Jul 03 1:42 PM
For Body of the mail, you need to pass the table in contents_txt.
and for attachment you need to pass it in packing_list.
I am not sure what Object_content is for.
‎2012 Jul 03 1:50 PM
Hi also define table i_receivers.
DATA: i_receivers LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
‎2012 Jul 03 2:03 PM
tables
packing_list = gt_objpack
object_header = gt_objhead
contents_txt = gt_objtxt
receivers = gt_reclist
You have to pass the above table - contents_txt ....
Example....gt_output_soli is my output content table....
*- Creation of the document attachment
*- Don't create attachment if no data is present
if g_lines <> 0.
loop at gt_output_soli into gf_output_soli.
gf_objtxt = gf_output_soli.
*- Append
append gf_objtxt to gt_objtxt.
*- Clear
clear gf_objtxt.
endloop.
endif.
Regards,
Venkat
‎2012 Jul 04 2:14 PM
Hi,
I am not able to find this contentc_txt table.
I amusing the FM 'SO_NEW_DOCUMENT_SEND_API1' in SAP ECC 6.0.
Following are the import/export/table values :
Import
======
DOCUMENT_DATA
DOCUMENT_TYPE
PUT_IN_OUTBOX
COMMIT_WORK
Export
======
SENT_TO_ALL
NEW_OBJECT_ID
Tables
==========
OBJECT_HEADER
OBJECT_CONTENT
CONTENTS_HEX ( take the contents in BINARY mode only)
OBJECT_PARA
OBJECT_PARB
RECEIVERS
---------------------------------------------------------
If this is not the appropriate function module for this purpose, can you please suggest the appropriate function module.
‎2012 Jul 04 2:21 PM
Use this function instead....
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = gf_doc_chng
* put_in_outbox = 'X'
* sender_address = ' '
commit_work = 'X'
importing
sent_to_all = g_sent_all
tables
packing_list = gt_objpack
object_header = gt_objhead
contents_txt = gt_objtxt
receivers = gt_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.
cl_os_transaction_end_notifier=>raise_commit_requested( ).
call function 'DB_COMMIT'.
cl_os_transaction_end_notifier=>raise_commit_finished( ).
else.
write 'Not send'.
endif.
Regards,
Venkat
‎2012 Jul 04 2:57 PM
Hi,
I am still getting the text attachment. Can you please provide me the details related this function module.
Like what the data you have populated in the FM etc.
‎2012 Jul 04 7:33 PM
Hi,
Better use new standards with the class CL_BCS!
Anyway your issue is quite common... Check your SMTP settings in SCOT. Output for RAW Text has to be set to TXT, not PDF.
Kr,
Manu.
‎2012 Jul 05 10:20 AM
‎2012 Jul 05 10:57 AM
What do you mean?? Is the output for RAW text is set to TXT in INT/SMTP settings or not?
‎2012 Jul 05 9:17 AM
Look my code for word gt_objpack...
tables
packing_list = gt_objpack
for that
you have to set the value as HTM as show below
*- Creation of the entry for the compressed document
gf_objpack-transf_bin = ' '.
gf_objpack-head_start = 1.
gf_objpack-head_num = 0.
gf_objpack-body_start = 1.
gf_objpack-body_num = g_msg_lines.
gf_objpack-doc_type = c_doc_type_htm. " value 'HTM',
*- Append
append gf_objpack to gt_objpack.
*- Clear
clear gf_objpack.
Regards,
Venkat
‎2012 Jul 05 10:22 AM
gf_objpack-doc_type = c_doc_type_htm. " value 'HTM' ---> Now this is creating a html file attachment instead of text file.
But its not coming in the body.
‎2012 Jul 05 11:07 AM
‎2012 Jul 05 11:46 AM
The SCOT settings is :
And I am getting the attachment istead of text in the body.