Ver Mensaje Individual
  #6  
Viejo 11/11/09, 22:51:56
Belerophonte Belerophonte is offline
Junior Member
 
Fecha de Ingreso: mar 2007
Mensajes: 11
Envio de Correo

Hola , yo mande correos de esta forma, solo que hay que pasarle como parametro el correo al cual sera enviado, ojala te sirva.

Saludos

FORM send .
DATA lv_texto(30) TYPE c.

REFRESH main_text.

TRY.

* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).

* -------- create and set document with attachment ---------------
* create document object from internal table with text
APPEND 'Pedidos próximos a vencer y vencidos' TO main_text.
CONCATENATE 'Grupo de Compras:' gc_tab
gv_ekgrp gc_tab
INTO lv_texto.
APPEND lv_texto TO main_text.
APPEND 'El contenido del reporte esta incluido en el archivo anexo' TO main_text.

document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = main_text
i_subject = 'Pedidos próximos a vencer y vencidos' ).

* add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls'
i_attachment_subject = 'Pedidos'
i_attachment_size = size
i_att_content_hex = binary_content ).

* add document object to send request
send_request->set_document( document ).

* --------- add recipient (e-mail address) -----------------------
* create recipient object
LOOP AT t_mailto INTO w_mailto.
recipient = cl_cam_address_bcs=>create_internet_address( w_mailto-mailto ).
* add recipient object to send request
send_request->add_recipient( recipient ).
ENDLOOP.



* ---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).

COMMIT WORK.

IF sent_to_all IS INITIAL.
MESSAGE i500(sbcoms) WITH mailto.
ELSE.
MESSAGE s022(so).
ENDIF.

* ------------ exception handling ----------------------------------
* replace this rudimentary exception handling with your own one !!!
CATCH cx_bcs INTO bcs_exception.
MESSAGE i865(so) WITH bcs_exception->error_type.
ENDTRY.
ENDFORM. " SEND
Responder Con Cita