2014 Jan 10 11:11 AM
Hi gurus!!
I am using this function in order to send a mail.
I would like to bold some part of the test of the body. As far as I have seen the only two thing to do are:
1- tab_packing_list-doc_type = 'HTML'.
2-
2- Define this way the part I want to be bolded:
v_txt = 'Nº DE AVISO:'.
CONCATENATE '<B>v_txt</B>' aviso-refnum INTO v_linea SEPARATED BY space.
APPEND v_linea TO tab_contents_txt.
Doing it this way the only this I get in the body of the mail is :
<
What else should I do?
What is wrong in the code?
Thanks in advance.
2014 Jan 10 11:19 AM
Hi Jaione,
Pass 'HTM' rather than 'HTML' if still not work you new FM as below.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = lt_mailsubject
document_type = 'HTM'
TABLES
object_content = lt_mailtxt
receivers = lt_mailrecipients
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.
Thnaks
Deependra
2014 Jan 10 11:19 AM
Hi Jaione,
Pass 'HTM' rather than 'HTML' if still not work you new FM as below.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = lt_mailsubject
document_type = 'HTM'
TABLES
object_content = lt_mailtxt
receivers = lt_mailrecipients
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.
Thnaks
Deependra
2014 Jan 13 9:16 AM
2014 Jan 13 9:23 AM
Hi Jaione,
Have you tried to send mail with binary content(HEX) or Business communication searvice (BCS)?
There are many answered post on sdn also related to this. Please try to search on sdn.
Thanks
Deependra
2014 Jan 14 10:31 AM
Hi!!
This is my code:
DATA: int_receiver LIKE sy-subrc.
DATA: w_doc_data LIKE sodocchgi1,
chr_email LIKE somlreci1-receiver.
DATA:
tab_contents_txt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
tab_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
tab_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: asunto LIKE sodocchgi1-obj_descr.
DATA: v_linea LIKE solisti1-line.
"------------------------------------------------------------"
CONCATENATE 'Aviso: ' aviso-refnum '-' aviso-zelpep '-' aviso-zcentral INTO asunto SEPARATED BY space.
w_doc_data-doc_size = 1.
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = asunto .
w_doc_data-sensitivty = 'F'.
" Crear cuerpo de mensaje
CLEAR v_linea.
v_txt = 'Nº DE AVISO:'.
CONCATENATE '<B>v_txt</B>' aviso-refnum INTO v_linea SEPARATED BY space.
APPEND v_linea TO tab_contents_txt.
CLEAR v_linea.
APPEND v_linea TO tab_contents_txt.
CONCATENATE 'Nº INCIDENCIA SAP:' aviso-refnum INTO v_linea SEPARATED BY space.
APPEND v_linea TO tab_contents_txt.
" Preparar los demas parametros para llamada a funcion
CLEAR tab_packing_list.
REFRESH tab_packing_list.
tab_packing_list-doc_type = 'HTML'.
tab_packing_list-transf_bin = space.
tab_packing_list-head_start = 1.
tab_packing_list-head_num = 0.
tab_packing_list-body_start = 1.
DESCRIBE TABLE tab_contents_txt LINES tab_packing_list-body_num.
APPEND tab_packing_list.
chr_email = 'jaione.arizkuren@indar.ingeteam.com'.* destinatatis del mail
CLEAR tab_receivers.
REFRESH tab_receivers.
tab_receivers-receiver = chr_email.
tab_receivers-rec_type = 'U'.
tab_receivers-com_type = 'INT'.* t_receivers-notif_del = 'X'.* t_receivers-notif_ndel = 'X'.
APPEND tab_receivers.
CLEAR tab_receivers.
REFRESH tab_receivers.
LOOP AT direcciones. " Cargar direcciones de correo en parametro
CLEAR tab_receivers.
tab_receivers-receiver = direcciones-receiver.
tab_receivers-rec_type = 'U'.
tab_receivers-com_type = 'INT'.
" t_receivers-notif_del = 'X'.
APPEND tab_receivers.
ENDLOOP.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
" SENDER_ADDRESS = SY-UNAME
"SENDER_ADDRESS_TYPE = 'B'
commit_work = 'X'* IMPORTING* SENT_TO_ALL =* NEW_OBJECT_ID =* SENDER_ID =
TABLES
packing_list = tab_packing_list* OBJECT_HEADER =* CONTENTS_BIN =
contents_txt = tab_contents_txt* CONTENTS_HEX =* OBJECT_PARA =* OBJECT_PARB =
receivers = tab_receivers
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 EQ 0.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ELSE.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* control codi dels receptors del mail
LOOP AT tab_receivers.
int_receiver = tab_receivers-retrn_code.
ENDLOOP.
ENDFUNCTION.
2014 Jan 14 12:04 PM
In the CONCATENATE statement, I think you missed two quotes.
CONCATENATE '<B>' v_txt '</B>' aviso-refnum INTO v_linea SEPARATED BY space.
Also, can you change the document size from 1 to the size of table. - something like..
data : wa_objtxt TYPE solisti1,tab_lines TYPE i.
DESCRIBE TABLE tab_contents_txt LINES tab_lines.
READ TABLE tab_contents_txt INTO wa_objtxt INDEX tab_lines.
w_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( wa_objtxt ).